Unix Timestamps and How Computers Track Time
What January 1, 1970 means, why counting seconds beats calendars, the Y2K38 problem, and how time zones complicate everything.
Every app you use daily — your bank, your email, your social feed — stores and retrieves data using some form of SQL. Invented at IBM in the 1970s, Structured Query Language has outlived every programming trend for over 50 years. Understanding its core operations takes about 20 minutes. Mastering it takes a career.
SQL organises everything around four verbs, often called CRUD (Create, Read, Update, Delete):
-- Read data
SELECT name, email FROM users WHERE active = true;
-- Create data
INSERT INTO users (name, email) VALUES ('Jane', '[email protected]');
-- Update data
UPDATE users SET active = false WHERE last_login < '2025-01-01';
-- Delete data
DELETE FROM users WHERE id = 42;SELECT is by far the most complex — it supports filtering, sorting, grouping, joining, and subqueries. The other three are straightforward once you understand WHERE clauses.
Real databases normalise data across multiple tables. A JOIN connects them:
| Join type | Returns | When to use |
|---|---|---|
| INNER JOIN | Only matching rows | You need data that exists in both tables |
| LEFT JOIN | All left rows + matching right | You want all users, even those without orders |
| RIGHT JOIN | All right rows + matching left | Rarely used; same as LEFT JOIN with tables swapped |
| FULL JOIN | All rows from both sides | You need a complete picture of unmatched data |
GROUP BY collapses rows into groups, and aggregate functions like COUNT, SUM, AVG, MIN, and MAX summarise each group:
SELECT department, COUNT(*) AS headcount, AVG(salary) AS avg_salary
FROM employees
GROUP BY department
HAVING COUNT(*) > 5
ORDER BY avg_salary DESC;In team codebases, SQL queries live in application code, migration files, and ad-hoc scripts. Compare these two versions of the same query:
-- Messy: hard to scan, easy to miss bugs
select u.name,o.total,o.created_at from users u join orders o on u.id=o.user_id where o.total>100 and u.active=true order by o.created_at desc limit 20;
-- Formatted: structure is visible at a glance
SELECT
u.name,
o.total,
o.created_at
FROM users u
JOIN orders o ON u.id = o.user_id
WHERE o.total > 100
AND u.active = true
ORDER BY o.created_at DESC
LIMIT 20;The SQL standard (ISO/IEC 9075) defines the language, but every database engine adds its own extensions:
NoSQL databases (MongoDB, Redis, DynamoDB) trade structured schemas for flexibility. Use SQL when your data has clear relationships and you need transactional guarantees. Use NoSQL when your schema evolves rapidly, you need horizontal scaling, or your data is naturally document-shaped (JSON blobs, user profiles, event logs).
SQL is not a database — it's a language. Learning it once gives you access to dozens of database engines, from a 50KB SQLite file to a petabyte-scale data warehouse.
What January 1, 1970 means, why counting seconds beats calendars, the Y2K38 problem, and how time zones complicate everything.
What UUIDs are, v4 vs v7, collision probability, hashing fundamentals, broken vs secure algorithms, and how JWTs carry authentication.
What structured data is, Schema.org and JSON-LD, common schema types and rich results, meta tags, Open Graph, and robots.txt explained.