History

  1. What was a key element that made the sequential-master-update process work in the 1970's when data was stored on tape drives?

    1. ✅ Keeping the data (master and transaction files) sorted on the tape drive → Read both tapes sequentially, like merging two sorted lists.
      1. If the transaction key is smaller, you output a new master record with the update.
      2. If the master key is smaller, you just pass it through unchanged.
    2. ❌ Copying the tape on to disk to allow random access → Early disks were extremely expensive and tiny compared to tape.
    3. ❌ Skipping forwards and backwards on the tape to find the data you needed → Isn’t how tape drives work—they were physically linear
  2. What is the primary value add of relational databases over flat files?

    1. ✅ Ability to scan large amounts of data quickly.
    2. ❌ Ability to store data in a format that can be sent across a network
  3. What is the key innovation that underlies the power of relational databases?

    1. ❌ Optimizing Rotational Latency → HDD optimization, not the foundation of relational DB power
    2. ❌ Solid State Drives (SSD) → Modern hardware
    3. ❌ Effective use of large amounts of RAM to avoid disk access → Useful but not the conceptual breakthrough
    4. ✅ Modeling data at the points of connection
  4. What organization was instrumental in bringing people together to build the SQL standard? National Institute of Standards and Technology (NIST)

  5. What is a commonly used term that is equivalent to "relation"?

    1. ❌ sheet
    2. ❌ dictionary
    3. ✅ table
  6. What is the typical name of the "all powers" account in a PostgreSQL server.

    1. ❌ root
    2. ✅ postgres
    3. ❌ sudo
  7. How does a PostgreSQL client like psql connect to a PostgreSQL server?

    A network connection

Setup

Run Postgres by Docker

# Run the postgres
docker run --name postgres \\
  -e POSTGRES_DB=postgres \\
  -e POSTGRES_PASSWORD=postgres \\
  -p 5432:5432 \\
  -d postgres:18

Use local’s psql

brew install libpq
brew link --force libpq
[Homebrew] → installs libpq formula
      ↓
[libpq] → contains psql, pg_dump, pg_restore, etc.
      ↓
Not linked by default → you run 'brew link --force libpq'
      ↓
psql command becomes available globally

Homebrew avoids linking libpq automatically because it conflicts with postgresql package. Since we don’t use postgresql package and use local psql to connect the Postgres in docker, so we force the command available globally.

# Enter the postgres server
psql "host=localhost port=5432 user=postgres password=postgres dbname=postgres"

Use postgres image’s psql

# Get into the continer
docker exec -it <continer_id> bash

# The container has installed the psql

# Login the postgres server 
psql user=postgres dbname=postgres
# or
psql -U postgres -d postgres

After Login

# After login
psql (18.1, server 18.0 (Debian 18.0-1.pgdg13+3))
Type "help" for help.

postgres=# SELECT version();