Tables and SQL

Lesson 1 of 18 · SQL foundations

A database stores organized information; a database management system (DBMS) reads and changes it. In a relational database, a table represents a collection of facts, a row is one record, and a column describes one attribute. A schema describes the tables, columns, types, and rules. SQL (Structured Query Language) expresses requests to the DBMS.

library database
  ├── shelves: id, label
  └── books:   id, title, shelf_id, pages

A shelf_id value can refer to a shelf’s id, allowing the facts to be related. SQL is a language, not the database itself: SQLite, PostgreSQL, MySQL, and SQL Server implement different dialects. SQLite runs embedded in an application; PostgreSQL commonly runs as a separate server. Their syntax, types, and behavior can differ.

Non-relational or NoSQL systems include document, key-value, graph, and wide-column databases. Some support SQL-like languages or schemas; neither model is inherently superior. Choose based on access patterns, consistency, operations, and constraints rather than assuming all non-relational data is nested.

Chapter index · Course index