SQL and Databases with Python
Move structured data out of ad hoc files and into a database you can trust. Design small relational schemas, ask precise questions with SQL, change data safely, use transactions, and build a tested Python program backed by SQLite.
Lessons are arranged in a recommended order, but you can open any lesson.
Chapter 1
When a File Is No Longer Enough
- Welcome to SQL and Databases with Python
- When the Catalog Starts Contradicting Itself
- SQLite: The Database in Your Pocket
- Tables, Rows, Columns, and a Schema
- Ask for One Column with SELECTpractice
- Connect Python to SQLitepractice
- Close and Reopen the Same Databasepractice
- Follow One Question Through the Database
Chapter 2
Create a Table That Protects Its Data
Chapter 3
Ask Precise Questions
- Select More Than One Columnpractice
- Filter One Category with WHEREpractice
- Combine Search Rules with AND and ORpractice
- Put Matching Items in Descending Orderpractice
- Break Ties with More Sort Keyspractice
- Keep Only the First Few Rowspractice
- Name Result Columns with ASpractice
- When a Query Finds No Rowpractice
- Project: Build a Lending Shortlistcapstone
Chapter 4
Summarize Many Rows
- Count the Items in the Catalogpractice
- Add Up the Loan Dayspractice
- Find the Shortest and Longest Loan Periodspractice
- Calculate an Average Loan Periodpractice
- Build One Summary per Categorypractice
- Filter Rows Before They Become Groupspractice
- Filter Finished Groups with HAVINGpractice
- Project: Build the Category Capacity Reportcapstone
Chapter 5
Change Data Safely
Chapter 6
Relate Tables Instead of Repeating Data
- Let a Loan Point to Two Records
- Add Foreign Keys to the Loans Tablepractice
- Turn Foreign-Key Checks Onpractice
- Follow a Loan to Its Memberpractice
- Read One Loan Across Three Tablespractice
- Find the Active Loanspractice
- Keep Items That Have No Active Loanpractice
- Select the Available Itemspractice
- Project: Report the Lending Deskcapstone
Chapter 7
Several Changes, One Outcome
- When a Checkout Stops Halfway
- Commit a Completed Checkoutpractice
- Recognize a Constraint Failure
- Roll Back the Whole Attemptpractice
- Let the Connection Choose the Outcomepractice
- The Connection Is Still Open
- Return One Loanpractice
- Refuse a Second Active Checkoutpractice
- Respect a Member's Loan Limitpractice
- Project: Check Out a Kit or Nothingcapstone
Chapter 8
Put a Python Boundary Around the Database
- Fetch All Rows from One Resultpractice
- Read Result Columns by Namepractice
- Configure Every Connection Oncepractice
- Let the Caller Own the Connection
- Return Plain Available-Item Recordspractice
- Put Checkout Behind One Commandpractice
- Translate Only a Known Catalog Conflictpractice
- Project: Complete the Catalog Database Modulecapstone
Chapter 9
Create, Import, and Evolve a Schema
- Rebuild the Schema from Sourcepractice
- Record the Schema Versionpractice
- Distinguish a Blank Database from an Unknown Onepractice
- Move Version 1 Forwardpractice
- Refuse a Version That Disagrees with Its Shapepractice
- Check the CSV's Shapepractice
- Validate Every CSV Row Before Writingpractice
- Import Every New Row or Nonepractice
- Make an Exact Repeated Import a No-Oppractice
- Project: Prepare a Catalog from Sourcecapstone
Chapter 10
Prove the Database Behaves
- Give Every Test a Fresh Databasepractice
- Test a Query by Its Public Resultpractice
- Catch a Broken Foreign-Key Boundarypractice
- Protect Both Checkout Rulespractice
- Prove a Commit by Reopeningpractice
- Prove an Import Rolls Back Mid-Batchpractice
- Reject a Version Marker That Liespractice
- Project: A Database Behavior Suitecapstone
Chapter 11
Capstone: A Persistent Lending Tool
- Choose a Command Before Opening the Databasepractice
- Initialize the Catalog Explicitlypractice
- Import Starter Items Without Duplicatespractice
- Register a Memberpractice
- Check Out One Itempractice
- Return an Active Loanpractice
- Print the Available Itemspractice
- Print the Lending Activitypractice
- Capstone: Prove the Complete Lending Toolcapstone
- Download and Run Your Project Locally
Chapter 12
Where to Go Next
Course reviews
No reviews yet
Be the first to share your experience.