Basic SELECT Queries
The SELECT statement retrieves data from tables. Basic syntax:
SELECT column1, column2
FROM table_name
WHERE condition;
For example, SELECT name, program FROM Student WHERE year = 3; lists names and programs of all 3rd-year students. The WHERE clause filters rows (using =, <, >, LIKE, etc.). You can select all columns with SELECT *, but in exams it's better to list needed columns. Always test your WHERE conditions.
JOIN Operations
To query multiple tables, use JOINs. The most common is INNER JOIN, which combines rows with matching keys. Example:
SELECT s.name, c.course_name
FROM Student s
JOIN Enrollment e ON s.student_id = e.student_id
JOIN Course c ON e.course_id = c.course_id;
This lists each student with each course they are enrolled in. There are also LEFT JOIN (includes all left-table rows even if no match) and RIGHT/FULL JOIN (right or both sides). In exams, INNER JOIN is most common. Use table aliases (like s, e, c) for brevity. Ensure you join on the correct key columns.
Aggregation and GROUP BY
ProReviewer — locked
Drills, code labs, and full solutions.
Subqueries (Nested Queries)
ProReviewer — locked
Drills, code labs, and full solutions.
Practice & Exam Drills — Lesson 5
ProReviewer — locked
Drills, code labs, and full solutions.