Commas and semicolons in SQL


I’m a bit confused about commas in SQL. I know i have to put a semicolon to close a statement but i’m not sure where use commas.
In this picture i have an example, i don’t understand why i have to use the comma after name.

Thanks in advance,


I believe there’s a comma after name because the case you created is still part of the SELECT statement. You can think of the Review column you created with the case statement as another column you are selecting in SQL


I think if you go on a bit further you’ll see why when you use that vs DISTINCT.

1 Like