Why isn't my case statement working?S

Hey guys, I’m unsure of why my case statement isn’t working? I’m using SQLITE3.

SELECT *
CASE
WHEN total_population < 1000000 THEN ‘There are under 1 million people in this state’
WHEN total_population > 1000000 THEN ‘There are over 1 million people in this state, but under 10 million people’
ELSE ‘There are over 10 million people in this state’
END
FROM states;

The error states [ERROR] near “CASE”: syntax error - I’m unsure of what this means.

Hi @byte5888360586,

Can you please include the link to the exercise?

You can also try putting a comma , after the *.

3 Likes

Hey, thanks for the help, the comma fixed this!

I just finished the SQL module in the Data Scientist: Data Analytics Specialist Career Course, and am applying what I’ve learnt to a dataset I imported, so I’m unable to link the exercise. But either way your help has resolved the issue so thanks again!

1 Like