SQL and Databases
Learn SQL from scratch: query, filter, group and join data, design tables, and see how PostgreSQL and Django use it, all with a small Ghanaian online shop.
- 0 students
- 100 lessons
- 6 h 52 min
Created by Ayim Nelson
What you will learn
- Explain tables, rows, columns, keys and relational databases
- Read data with SELECT, WHERE, ORDER BY, LIMIT and DISTINCT
- Summarise data with COUNT, SUM, AVG, GROUP BY and HAVING
- Create tables with constraints, and insert, update and delete rows safely
- Join related tables, and use subqueries, CASE and SQL functions
- Speed up queries with indexes and protect data with transactions
- Design a small normalised schema, and see how PostgreSQL and Django use SQL
About this course
Almost every app keeps its data in a database, and SQL is the language for talking to it. In short, friendly lessons you'll query a small online shop, Akwaaba Market, with customers in Accra, Kumasi and Tamale, prices in cedis and mobile money payments. Every example runs right here in your browser, with Python and SQLite.
For: beginners heading for backend or full-stack work. A little Python helps, but you'll only change the SQL inside the examples.
By the end: you'll read, filter, summarise and join data, create and change tables safely, design a small database of your own, and know how PostgreSQL and Django use the SQL you've learned.
Course content
11 sections · 100 lessons
Databases and SQL7 lessons
- What is a database?PreviewReading · 3 min
- Tables, rows and columnsPreviewReading · 3 min
- Relational databases and other kindsPreviewReading · 3 min
- What SQL isReading · 3 min
- Running SQL from PythonReading · 4 min
- Meet the Akwaaba Market databaseReading · 4 min
- Your first queryExercise · 6 min
Reading data with SELECT9 lessons
- SELECT and FROMReading · 3 min
- Selecting every column with *Reading · 2 min
- Calculations in SELECTReading · 3 min
- Renaming columns with ASReading · 3 min
- Sorting with ORDER BYReading · 3 min
- Sorting by several columnsReading · 3 min
- LIMIT and OFFSETReading · 3 min
- Removing duplicates with DISTINCTReading · 2 min
- Most valuable stockExercise · 10 min
Filtering with WHERE10 lessons
- WHERE and comparisonsReading · 4 min
- Combining conditions with ANDReading · 2 min
- Either condition with ORReading · 3 min
- Turning a condition around with NOTReading · 2 min
- Matching a list with INReading · 3 min
- Ranges with BETWEENReading · 3 min
- Matching patterns with LIKEReading · 3 min
- Missing values and IS NULLReading · 3 min
- The order of the clausesReading · 3 min
- Customers to emailExercise · 10 min
Summarising data8 lessons
- Counting with COUNTReading · 4 min
- Adding up with SUMReading · 3 min
- Averages with AVG and ROUNDReading · 3 min
- Smallest and largest with MIN and MAXReading · 3 min
- Grouping rows with GROUP BYReading · 4 min
- Filtering groups with HAVINGReading · 4 min
- Busy categoriesExercise · 10 min
- Querying reviewQuiz · 8 min
Creating tables and changing data14 lessons
- CREATE TABLEReading · 3 min
- Data types in SQLiteReading · 4 min
- Storing money and datesReading · 3 min
- PRIMARY KEYReading · 3 min
- NOT NULLReading · 2 min
- UNIQUEReading · 3 min
- DEFAULTReading · 3 min
- CHECKReading · 3 min
- Adding rows with INSERTReading · 4 min
- Changing rows with UPDATEReading · 3 min
- Removing rows with DELETEReading · 3 min
- The danger of a missing WHEREReading · 3 min
- ALTER TABLE and DROP TABLEReading · 3 min
- Fix the supplier listExercise · 12 min
Relationships and joins11 lessons
- Related tablesReading · 3 min
- Foreign keysReading · 4 min
- Many-to-many with a join tableReading · 3 min
- INNER JOINReading · 4 min
- Table aliasesReading · 2 min
- LEFT JOINReading · 4 min
- Finding rows with no matchReading · 3 min
- Joining three tablesReading · 3 min
- Joins with GROUP BYReading · 3 min
- Self-joinsReading · 3 min
- Best customersExercise · 12 min
Subqueries, CASE and functions8 lessons
- SubqueriesReading · 3 min
- Subqueries with INReading · 3 min
- CASE expressionsReading · 4 min
- Text functionsReading · 3 min
- Joining text with ||Reading · 3 min
- Dates in SQLiteReading · 4 min
- Handling NULL with COALESCEReading · 3 min
- Products above averageExercise · 12 min
Indexes, transactions and constraints9 lessons
- What an index isReading · 3 min
- Creating an indexReading · 3 min
- Seeing the query planReading · 3 min
- The cost of indexesReading · 3 min
- TransactionsReading · 3 min
- BEGIN and COMMITReading · 3 min
- ROLLBACKReading · 3 min
- Constraints keep data safeReading · 3 min
- A safe transferExercise · 12 min
Designing a database8 lessons
- Why design mattersReading · 3 min
- NormalisationReading · 3 min
- First normal formReading · 3 min
- Second and third normal formReading · 4 min
- Naming tables and columnsReading · 3 min
- Planning a schemaReading · 3 min
- From plan to CREATE TABLEReading · 3 min
- Tag the productsExercise · 15 min
PostgreSQL8 lessons
- Meet PostgreSQLReading · 3 min
- SQLite and PostgreSQL comparedReading · 4 min
- Using psqlReading · 3 min
- SERIAL and IDENTITY columnsReading · 3 min
- PostgreSQL data typesReading · 4 min
- TIMESTAMPTZ and time zonesReading · 3 min
- Why Django and production apps use PostgreSQLReading · 3 min
- From PostgreSQL to SQLiteExercise · 10 min
SQL from Python and Django8 lessons
- Using sqlite3 in your own programsReading · 3 min
- Placeholders and SQL injectionReading · 4 min
- Django models are tablesReading · 3 min
- The Django ORM and SQLReading · 3 min
- Django lookups, aggregates and joinsReading · 4 min
- Seeing the SQL Django runsReading · 3 min
- Customers in a cityExercise · 10 min
- Final quizQuiz · 12 min
Reviews
No reviews yet.
Comments
Log in to join the conversation.
Loading comments...