Module 1 · Tables, types and the question you are actually asking

Reading a database somebody else built

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 9 of 12 in this chapter

This chapter’s goalSet up a working database on your own machine, read an unfamiliar schema well enough to say what one row of each table means and which columns join to which, and state the grain of any result you are about to compute before you compute it.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

The situation

You are given access to a database with 180 tables, no documentation, and a question to answer by Thursday. The person who designed it left. This is the normal case, not the unlucky one, and there is a routine for it that takes about forty minutes.

Find out what exists, and how big it is

SQL
-- Postgres: tables with a live row estimate, largest first
SELECT relname, n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC
LIMIT 40;

Size is the fastest guide to importance. The three biggest tables are almost always the event tables (the things that happen) and the small ones are the entities and the lookup lists. A table with 12 rows is a controlled vocabulary; a table with 400 million is a log.

Portable equivalents: \dt and \d tablename in psql, .tables and .schema in SQLite, SHOW TABLES and DESCRIBE t in MySQL, and information_schema.columns everywhere.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Building Apps with AI exam.

Stuck on something?Ask Divya, your AI tutor

How to cite: Addaly (2026) ‘Reading a database somebody else built’, in Data, SQL and Getting to the Answer. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/data-and-sql/reading-an-unfamiliar-schema (Accessed: 29 November 2026).