Tables, Rows, and Columns in SQL

A table organizes rows around named columns. Each row describes one occurrence or relationship under the table's design.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a small catalogue
  2. Choose one row meaning
  3. State what one example row represents
  4. Separate logical rows from output order

Trace a small catalogue

A books table can hold a book ID, title, and publication year per row. Two books may share a title and have different IDs. This is a stored version of records with named fields.

Choose one row meaning

If a book can have many authors, a separate author relationship can retain one row per pairing. Give each table a clear unit of observation. Binary relations explain the pair model.[1][2]

State what one example row represents

A track table can have one row per recording, with numeric ID, display title and duration in seconds. Several recordings can share a title and still be separate rows. Adding an artist table changes where descriptions live but does not change the identity of a track row. See row granularity.

id  title     duration_s
7   Crossing    120
9   Crossing    145
Distinct recordings share a title

Separate logical rows from output order

A table query needs an explicit ordering to make a display sequence predictable. Column names specify each value's role. Test two similar rows and verify their IDs and durations are not swapped.

References

  1. PostgreSQL Global Development Group, Data Definition ↩
  2. PostgreSQL Global Development Group, SQL Language Tutorial ↩