liveBook · Manning

SQL

As explained in Build Python Web Apps with Streamlit

A search query is a textual request specifying the items or information to retrieve from a search service.

SQL, or Structured Query Language, is the language used to create, manage, and query relational database tables. It requests exactly the data an application needs and supports persistent storage beyond a program’s runtime. section 8.2.1 section 8.2.4

A table contains rows and columns, while a schema defines column types and relationships. Start with CREATE TABLE, then use INSERT, SELECT, UPDATE, and DELETE to implement CRUD workflows. section 8.2.1 section 8.2.4

Build queries incrementally:

  • Use SELECT * FROM users to retrieve every column and row. section 8.2.4
  • Select specific columns and filter records with WHERE, AND, and LIKE, such as finding Alice’s haikus containing “fox”. section 8.2.4
  • Change matching records with UPDATE and remove them with DELETE; test each operation by running a follow-up SELECT. section 8.2.4
  • Use constraints such as PRIMARY KEY and FOREIGN KEY to identify rows and connect related tables. section 8.2.4

Loading warehouse data

A BigQuery-backed dashboard can construct SELECT * FROM a fully qualified project, dataset, and table name, execute the query, wait for its result, and convert the result to a pandas dataframe. Filtering large datasets in BigQuery can avoid loading all data into memory first. section 7.7.3

CREATE TABLE users (
  username VARCHAR(100) PRIMARY KEY,
  password_hash VARCHAR(128)
);

Inspect a complete CREATE TABLE statement defining users, a VARCHAR column, and a PRIMARY KEY. section 8.2.4

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains tables, schemas, data types, keys, CRUD statements, filtering, and execution, but stops short of advanced SQL.
Examples
Uses users and haikus tables, Alice’s records, filtered fox-text searches, updates, deletions, and BigQuery sales data.
What it assumes
Assumes basic tabular-data familiarity while teaching relational tables, schemas, persistence, SQL syntax, and CRUD from fundamentals.
What you can do after
Apply SQL via psql to create tables, insert records, query filtered data, update rows, delete records, and inspect results.
How it connects
Connects SQL with relational databases, PostgreSQL, BigQuery, CRUD, Streamlit, pandas dataframes, schemas, and authentication.

Also explained in

Compare how 25 books explain SQL →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.