CHAPTER 1
And why is it one of the most valuable skills you can learn in tech?
When you scroll Instagram, the app sends a SQL query that looks something like:
SELECT post_id, image_url, caption, like_count
FROM posts
WHERE user_id IN (
Select following_id FROM followers WHERE user_id = ?;
)
ORDER BY created_at DESC
LIMIT 20;This query runs millions of times per second at scale, SQL is the universal language of data.
| Term | What It Means | Real-World Analogy |
|---|---|---|
| Database | A container holding all related tables | All of Swiggy's data - users, restaurants, orders |
| Table | One entity stored as rows + columns | The "orders" spreadsheet inside Swiggy's database |
| Row / Record | A single record in a table | A single order placed by Ananya |
| Column / Field | One attribute of each row | The "total_amount" column in the orders table |
| Primary Key | Unique ID - no two rows share it | Your Aadhaar number |
| Foreign Key | A column that links to another table's primary key | order.customer_id --> customer.customer_id |
| Query | A SQL statement asking a question or giving a command | SELECT name FROM employees WHERE salary > 7000 |
| Schema | The structure definition of a database | The blueprint listing all tables and their columns |
💡 Engineering Insight: At Google, databases can have tables with trillions of rows annd schemas with hundreds of tables. Yet the SQL you write today is the same SQL engineers write at Google - the language scales from 8 rows to 8 trillion.