Course map
Stage 1: Foundation
Stage 2: Intermediate
Stage 3: Advanced
Stage 4: Performance & internals
Stage 5: Specialization

Part 09 / Topic 7 of 7

Naming conventions

Names are the schema's user interface, and the convention matters less than its uniformity. The one this course uses — and the one most Postgres teams converge on:

  • snake_case, lowercase, always — Part 2 showed how unquoted identifiers fold to lowercase anyway; capitals buy you a lifetime of double quotes.
  • Tables plural (customers, order_items); columns singular (city).
  • Primary key <entity>_id (customer_id), and the foreign key keeps the same name — orders.customer_id points at customers.customer_id, so joins read as equations and USING works.
  • Booleans read as predicates (is_active, has_stock); timestamps say their event (created_at, paid_at, cancelled_at).
  • No prefixes (tbl_), no abbreviations that save three characters and cost every reader a lookup (cust_adr_ln2).

Write the convention down — half a page — the day the project starts. The cost of inconsistency isn't aesthetic: every inconsistent name is a query bug waiting (user_id vs userid vs uid in three tables).

🧪 Quick quiz — answer from memory, then check.

  1. Why do foreign keys keep the referenced column's exact name?
  2. Why avoid capitals in identifiers at all?
Show the answers
  1. Joins become self-documenting (o.customer_id = c.customer_id) and USING (customer_id) works.
  2. Postgres folds unquoted names to lowercase, so capitals force quoting everywhere, forever.

Done here? The practice set for Part 9 — 4 exercises with solutions — is on the part page.

Search the guide