SQL Fundamentals
Create tables and views, and query, filter, join, aggregate and modify relational data with standard SQL, using PostgreSQL as the reference engine.
5 objectives 6 steps about 145 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Write SELECT queries that filter, sort and limit rows, handling NULL with three-valued logic correctly.
- Combine tables with inner, left, full and self joins and explain row-count changes caused by join cardinality.
- Summarize data with GROUP BY, HAVING, aggregate functions and CASE-based conditional aggregation.
- Create tables with suitable data types and constraints, and insert, update and delete rows without touching unintended data.
- Answer questions with scalar, IN, EXISTS and correlated subqueries, and rewrite a correlated subquery as a join or anti-join that returns the same rows.
Lesson plan
6 steps, about 145 min · 5 of 5 lessons available so far
- Tables, Rows and a First Session in psql Concept · 20 min
- Filtering, Sorting and the NULL Trap Worked example · 25 min
- Joins and Subqueries Without Multiplying Rows Lab · 30 min
- Turning Rows into Business Metrics Lab · 25 min
- Tables, Views and Changing Data Safely Lab · 25 min
- Check: Answer Questions About an Unseen Schema Knowledge check · 10 questions
Practise it
Load a sample schema (for example a DVD-rental or online-store dataset) into PostgreSQL and write ten queries that answer stated business questions, including a left join that keeps unmatched rows, a NOT EXISTS query that finds customers with no orders, a grouped report filtered with HAVING and published as a view, and an UPDATE previewed with SELECT first; automated tests compare each result with the expected rows.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own DatabaseAdvanced · 30–60 h
References
Hard prerequisites
None.
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.