My issue
what is this line mean ‘GROUP BY 1’?
My code
/* Write a query to categorize the students based on the marks into grades and output the count of students in each grade. Give the Alias name for the CASE as 'Grades"
- Marks Less than 50 - C,
- Marks between 50 and 80 - B,
- Marks more than 80 - A */
SELECT
CASE
WHEN marks<50 THEN 'C'
WHEN marks BETWEEN 50 AND 80 THEN 'B'
WHEN marks>80 THEN 'A'
ELSE 'NA'
END AS Grades,
COUNT(*) AS student_count
FROM marks
GROUP BY 1;
Learning course: SQL Intermediate
Problem Link: CodeChef: Practical coding for everyone