select (CASE WHEN (market_cap < 300000000) THEN 'micro' WHEN (market_cap < 2000000000) THEN 'small' WHEN (market_cap < 10000000000) THEN 'mid' WHEN (market_cap < 50000000000) THEN 'large' ELSE 'mega' END) AS `cap_type` from companies;