Here’s the Database Diagram for the SQL Exercises.
- Creating Primary and Foreign keys in existing tables
- Creating a primary key
- Creating a foreign key
- How to SELECT column names in a table
- SQL:
- Result:
- AGGREGATIONS: SELECT aggregated and non-aggregated columns from a table
- Task: List the total Staffing Entitlements for each school.
- Source table: [Staffing]
Note how the same school appears in multiple rows. - SQL:
- Result: [Total Staffing Entitlement] is aggregated by School Code.
- Alternative: The same result can be obtained by using a shorter query shown below.
- ORDER BY vs HAVING
- SQL:
- Result:
- SUBQUERIES
- SQL:
- Result:
- SQL:
- Result:
- HOW TO INSERT, UPDATE AND DELETE DATA
- SQL:
- Result:
- SQL:
- Result:
- SQL:
- Result: