You’ve just been appointed as the SQL expert at Dynamic Data Academy, a prestigious institution celebrated for its variaty of courses and programs. As part of your role, you’re tasked with analyzing enrollment data stored in the college’s Snowflake database. The table structure is as follows:
To create your dataset
CREATE TABLE student_enroll_info (
student_id INT PRIMARY KEY,
course VARCHAR(50),
duration VARCHAR(50)
);
-- Step 2: Insert data into the table
INSERT INTO student_enroll_info (student_id, course, duration) VALUES
(1, 'CSE', 'Four Years'),
(2, 'EEE', 'Three Years'),
(3, 'CSE', 'Four Years'),
(4, 'MSC', 'Three Years'),
(5, 'BSC', 'Three Years'),
(6, 'Mech', 'Four Years');
How do you count the total number of students grouped by each course and duration separately?
Hint: Have you ever heard about GROUP BY GROUPING SETS? 😊
Remember if you want to participate:
- Sign up as a member of Frosty Friday. You can do this by clicking on the sidebar, and then going to ‘REGISTER‘ (note joining our mailing list does not give you a Frosty Friday account)
- Post your code to GitHub and make it publicly available (Check out our guide if you don’t know how to here)
- Post the URL in the comments of the challenge.
sriganeshpalani says
https://github.com/sriga2013/Frosty_Friday/tree/main