I am new in SQL, and I am learning alone on Udemy. I came across multiple questions, and I am struggling with one of them:
What is wrong with this SQL query?
SELECT sport, count(*)
FROM activities
WHERE username IN ‘tony’
GROUP BY 1;
I have two hypothesis: 1 - If the field 'sport' in activities is filled with string values, then we can't use count. 2 - the last statement should be rather:
WHERE username in:‘tony’ GROUP BY 1;
I would be happy to have your feedback on the question and learn from you! Thanks
search IN will use with () round brackets
SELECT sport, count(*)
FROM activities
WHERE username IN ('tony')
GROUP BY 1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With