Why is this command wrong?

I write the command as below:
(CASE WHEN (WHERE title like ‘IT’%) then ‘IT sector’ END) AS ‘sector’
FROM employee;

The system says “OperationalError: near “AS”: syntax error”
The database I use is “chinook.db”

Please tell me why this command is wrong. Thanks in advance!

You should technically be facing two different errors assuming you are working on DQ’s platform or working locally with SQLite.

First, you can’t use WHERE in your CASE expression. You only need title like since WHEN sort of works like WHERE in this situation.

Second, for like, the percentage sign % needs to be inside the string quotes.

(CASE WHEN (title like "IT%") then "IT sector" END) AS "sector"
FROM employee;

The above should work as intended, I believe.

For future reference, please make sure to follow the technical guidelines listed here whenever applicable. Especially, guidelines 3 and 4.