Part 4 — SQL Queries
CLO6 · ~20 marks. Eight sub-questions on the same university schema from Part 3. Write clean, runnable SQL — right keys, right joins, right filters.
Q7(a)smallCreate the student table and insert two records. (1)
Q7(b)Create the enrolls table. (2)
Q7(c)Add column ‘booklist’ to course; rename ‘room’ → ‘classroom’ in course-offering. (2)
Q7(d)Raise salary 5% for professors earning > 10000, and 10% for everyone else. Use CASE. (3)
Q7(e)List students (id, name, secno, semester) enrolled in CSE303 in Spring 2026, sorted by student id ascending. (3)
Q7(f)bigList courses + sections with more than 30 students in Spring 2026, ordered by course & section no. (4)
Q7(g)Find instructors (name, id) who taught in Autumn 2025 but NOT Summer 2025. Use a set operation. (3)
Q7(h)List every program with its number of admitted students. (2)
SQL clause order — say it out loud
SELECT → FROM → JOIN → WHERE → GROUP BY → HAVING → ORDER BYWant to run SQL on live seeded tables? Open the SQL Playground →
Back to the Exam Pattern & Cheat Sheet →