C
Database//Lesson 01

Mastering Databases

30 min·theory

Mastering Databases

🎯 After reading this lesson

After completing this lesson, you will be able to confidently do the following 3 things.

  • ✅ SQL (the standard language for commanding a database) / practical application in 'Mastering Databases (a system for storing and querying data)'
  • ✅ How to verify queries using EXPLAIN (a command that shows how a query executes)
  • ✅ 3 frequently asked interview questions

Keep the learning goals as a checklist and close the lesson once you can answer all of them.

🗄️ The People Who Built Databases — 4 People, 4 Panels

01
Edgar F. CoddEdgar Codd
Father of Relational DatabasesIBM Research1923~2003

'A Relational Model of Data' — 30 lines of a paper built 50 years of the database industry

  • 1970 IBM Research — Publication of the Relational Model paper
  • 1972 Definition of Codd's 12 Rules for the relational model
  • 1981 ACM Turing Award recipient
  • 1990 Publication of 'The Relational Model for Database Management v2'
SQL, Oracle, PostgreSQL, MySQL — the theoretical foundation for all RDBMSRELATIONAL MODEL · Father of Relational DB
02
Larry EllisonLarry Ellison
Founder of OracleOracle Corporation1944~Present

Read one Codd paper and founded the world's second-largest software company

  • 1977 Founded Software Development Laboratories (now Oracle)
  • 1979 Released Oracle V2 — the world's first commercial RDBMS
  • 2010 Acquired Sun Microsystems — gained Java and MySQL simultaneously
  • 2024 Oracle market cap surpasses $400B+, maintaining its position as the world's #1 enterprise database
Oracle DB — the infrastructure standard for banks, governments, and enterprises worldwideORACLE · King of Enterprise DBs
03
Michael StonebrakerMichael Stonebraker
Creator of PostgreSQL (INGRES · POSTGRES)UC Berkeley → MIT CSAIL1943~Present

A 30-year obsession — the scholar who personally wrote database history from INGRES to PostgreSQL

  • 1974 UC Berkeley launches the INGRES project
  • 1986 POSTGRES — an object-relational database research project
  • 1996 POSTGRES released as open source under the name PostgreSQL
  • 2014 ACM Turing Award recipient
PostgreSQL — #1 most-loved database by developers on Stack Overflow 2024POSTGRESQL · King of Open Source DBs
04
Monty WideniusMonty Widenius
Creator of MySQL / MariaDBMySQL AB → Sun → MariaDB Foundation1962~Present

A free database built by a Finnish developer took over the internet

  • 1995 MySQL AB in Finland — MySQL is created
  • 2001 MySQL takes the 'M' spot in the LAMP stack, becoming a web standard
  • 2008 Sun Microsystems acquires MySQL AB for $1B
  • 2009 Opposition to Oracle merger — MariaDB fork formed, carrying on the open-source legacy
MySQL → WordPress → 43% of the internet. Open-source DNA carried on through MariaDBMYSQL · Popularization of Internet DBs
In a nutshell
Codd's theory (1970) → Ellison's commercialization → Stonebraker's open source → Widenius's popularization. Four people built 50 years of databases.
🔬 PostgreSQL recommendation: BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (auto-increment)

Why You Need to Know Databases

In a nutshell: Every service's data is stored somewhere. The way it's stored defines the limits of the service.


Tool Mapping — The English in each cell is just a tool name; focus on the description beside it

Use CaseDB Standard
Tabular DBPostgreSQL · MySQL · Oracle (RDBMS — stores data in rows and columns)
Fast temporary storageRedis · Memcached (in-memory cache readable in under 1ms)
Flexible-format DBMongoDB · DynamoDB (NoSQL — document/key-value storage instead of tables)
Search engineElasticsearch · OpenSearch (quickly find words within text)
Time-series recordingTimescaleDB · InfluxDB (time-series — data accumulated in chronological order)
Large-scale analyticsBigQuery · Snowflake · ClickHouse (analytics DB for aggregating hundreds of millions of rows)

5 Key Reasons

ReasonMeaning
Index (a lookup structure for fast retrieval)1 million rows searched in 0.001s vs 10s. Decided by a single B+Tree (a data structure that keeps data sorted) line
Transaction (a grouped unit of work)Safety for transfers and payments. Without ACID (Atomicity, Consistency, Isolation, Durability — four guarantees), money disappears
Isolation levelEnsures data consistency under 1,000 concurrent requests
JOIN (connecting multiple tables) · Normalization (splitting tables to eliminate duplication)Eliminate data duplication + efficient querying
N+1 · Execution planSame result, 100x difference in performance. EXPLAIN (a command that shows how a query executes) is your skill benchmark

Key takeaway: The ability to handle tens of thousands of rows with a single SQL statement is the fundamental skill of every backend developer.

🤖 Try Prompting AI Like This

Once you know the concepts in this lesson, you can give AI specific instructions. Not a vague 'fix this' but a request with vocabulary — that's the starting point for saving tokens (the unit of text AI processes at once).

  • 'Design a schema for 3 tables: users, orders, products + FK (foreign key — a column that references a row in another table) + indexes. Based on MySQL 8.'
  • 'Add EXPLAIN (a command that shows how a query executes) to this query, interpret the execution plan, and recommend indexes.'
  • 'Draw a user session + cache architecture using a combination of RDBMS (relational DB) and Redis (in-memory cache).'

Why This Saves Tokens

Knowing the basic database vocabulary (table, FK, index, transaction, EXPLAIN) lets you get a complete answer from AI in one shot. If you start by asking 'What is an index?', you end up spending 2-3x more tokens.

Database - Database