SQL in 10 Queries: From SELECT to LEFT JOIN
Ten SQL queries on one small shop: a left join finds the 1 customer who never ordered.
Video #297 ยท SQL and analytics
Steps in the video
Files
- queries.py (24 lines)
- run.py (12 lines)
- shop.py (25 lines)
Tested with
Python 3.12.15
What this does not show
The shop data is made up and tiny, so the video says nothing about speed or indexes; it does not cover insert beyond setup, update, delete, dates, subqueries or right and full joins.
Sources
- https://docs.python.org/3.12/library/sqlite3.html
- https://www.postgresql.org/docs/current/queries-order.html
- https://www.postgresql.org/docs/current/tutorial-agg.html
- https://www.postgresql.org/docs/current/tutorial-join.html
- https://www.sqlite.org/lang_aggfunc.html
- https://www.sqlite.org/lang_select.html
Learning IT by Example.