CSE 344 section 02 -- more SQL practice ================================================================ For this section, we'll be practicing SQL on the whiteboard (no computer). We will use the same database as last week: Class(dept, number, title) Instructor(username, fname, lname, started_on) Teaches(username, dept, number) See section2-schema.sql for the CREATE TABLE code, INSERT code, etc. See section2-solution.sql for the solution code. Review of joins Who teaches CSE 451? What courses does Dr. Zahorjan teach? Which courses do both Dr. Levy and Dr. Zahorjan teach? Queries using aggregation functions How many classes are there in the course catalog? What are the highest and lowest class numbers? How many classes are being taught by at least one instructor? General case: tricky, solution involves both subqueries and grouping, because SQL aggregate functions only allow a single column Special case: assume every class has the same department Queries with both grouping and aggregation How many instructors teach each class? Which instructors teach more than 1 class? try this with and without grouping A few subquery problems Which courses do neither Dr. Levy nor Dr. Wetherall teach?