Memra

Tables, rows, and your first SELECT

◈ 2 cards

How relational data is shaped, and how to read it back.

Data in tables

A relational database stores data in tables. A table is a grid: each row is one thing (one book, one customer) and each column is one attribute of that thing (a title, a price). Unlike a spreadsheet, every value in a column has the same type, and rows have no inherent order — you ask for the order you want.

Throughout this course you'll work a single small database: an online bookshop. Its core table is books. To read data you write a query with SELECT. The simplest one asks for every column (*) of every row:

SELECT * FROM books;

Run it below against real Postgres and look at the columns you get back. Open the schema panel any time to see every table.

idtitlegenreprice1The Glass Forestfiction14.992Quantum Morningsscience22.504Northern Lightpoetry9.99One row = one book. One column = one attribute.
Every value in a column has the same type, and rows carry no inherent order — SELECT * hands back all of them, and you ask for an order when you need one.
NORMAL ~/memra/learn/postgresql/what-is-a-relational-database utf-8 LF