SELECT CASE WHEN Sample_size < 200 THEN 'Small' WHEN Sample_size < 1000 THEN 'Medium' ELSE 'Large' END AS Sample_category FROM recent_grads;
Above is the solution code is given for the task in that screen. Here we did not use the Sample_size column after the SELECT statement but below is the code given in tutorial whare to make use of the WHEN and THEN statements we also used the Rank column in the SELECT statement. When I try to remove the Rank form the code below and try to make it similar to the code given on the solution to the task it is giving error. Can you please explain the difference?
SELECT Major, Rank, CASE WHEN rank <= 10 THEN 'Top 10' WHEN rank <= 20 THEN 'Top 20' ELSE NULL END AS rank_category FROM recent_grads;