Databases & SQL
When files aren't enough, you reach for a database โ and the language for talking to most of them is SQL. It's more approachable than it looks, and it's one of the most valuable skills a developer can have.
As data grows - more records, real relationships, many users - you graduate from files to a database: software built to store, search and manage data reliably at scale. Most databases speak SQL, a language for asking questions of data that's been a cornerstone of software for decades. SQL has a reputation for being technical, but the everyday core is genuinely approachable - and it's among the most valuable, durable skills you can learn. This session demystifies both.
Tables, rows, and relationships
The most common kind of database is relational: data lives in tables (like spreadsheets) of rows and columns, and tables can relate to each other.
| Concept | What it is |
|---|---|
| Table | A collection of one kind of thing (users, orders) |
| Row | One record (one user) |
| Column | One field of every record (name, email) |
| Relationship | A link between tables (a user's orders) |
A 'users' table has a row per user with columns like name and email; an 'orders' table links each order to a user. This structure - tables of rows, related to each other - models most real-world data cleanly, and it's what 'relational database' means. It's the same records-and-fields idea you've used, organised for scale and relationships.
The core of SQL
SQL is how you talk to the database. The single most important statement is SELECT, which queries data - and it maps exactly onto the filter/sort/select you know.
SELECT name, email -- which fields (select)
FROM users -- which table
WHERE active = true -- filter
ORDER BY created DESC -- sort
LIMIT 10; -- limitA cornerstone skill
- A database stores and manages data reliably at scale, beyond what files handle.
- Relational databases use tables (rows + columns) that relate to each other.
- SQL is how you query them; SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT is the core.
- It maps onto filter/sort/select - you already think this way. SQL is a durable, valuable skill.
๐ฏ Key takeaways
- As data grows, you move from files to a database - software that stores and manages data reliably at scale.
- Relational databases organise data into tables (rows and columns) that can relate to each other.
- SQL is the language for querying most databases; SELECT ... FROM ... WHERE ... ORDER BY ... LIMIT is its core.
- SQL's SELECT maps directly onto the filter/sort/select you already know - and it's a durable, valuable skill.
Frequently asked
SQL looks intimidating. How hard is it really to learn?
SQL looks more intimidating than it is, and the everyday core - especially querying data, which is what you'll do most - is genuinely approachable, particularly once you realise it maps onto the filter/sort/select thinking you've already practised. The most-used SQL statement is SELECT, for reading data, and its basic form reads almost like structured English: SELECT (which columns you want) FROM (which table) WHERE (the filter condition) ORDER BY (how to sort) LIMIT (how many). If you can express 'I want the names and emails of active users, newest first, just the first ten', you can write the SQL for it, because it's the same query broken into those clauses - which is exactly the querying you did over a list of dicts, just in SQL's words. That core querying ability covers a huge portion of real SQL work and is learnable quite quickly. Beyond SELECT, the other everyday statements are also straightforward in their basic forms: INSERT (add a row), UPDATE (change rows matching a condition), DELETE (remove rows matching a condition) - the create/read/update/delete operations. Where SQL gets more involved - and where its intimidating reputation partly comes from - is the more advanced features: JOINs (combining data from related tables, which is powerful and central to relational databases but takes some practice to think in), grouping and aggregating per category (GROUP BY), subqueries, and complex conditions. These are learnable too, but they're the deeper end you grow into, not the entry point. The good news is you can be productive with SQL knowing just the basics of SELECT with WHERE/ORDER BY/LIMIT plus simple INSERT/UPDATE/DELETE, and add JOINs and the rest as you need them. Another reason it's approachable: SQL is declarative, meaning you describe what data you want rather than writing step-by-step instructions for how to get it - you say 'the active users sorted by date' and the database figures out how to retrieve them efficiently, which is often more intuitive than imperative code once it clicks. And SQL is remarkably consistent and durable - it's been a standard for decades, works across most databases with minor variations, and the skills you learn transfer everywhere and stay relevant, making it one of the highest-return things to learn. So: start with SELECT and basic querying (which your list-querying practice has prepared you for surprisingly well), get comfortable with the create/read/update/delete basics, and layer in JOINs and advanced features gradually as real needs arise. It's far friendlier than its reputation, the core is quick to learn, and it's a genuinely valuable, lasting skill. Don't let the intimidating appearance stop you - if you can think in filter/sort/select, you can already read and write basic SQL, and the rest builds from there.
There are lots of kinds of databases (SQL, NoSQL...) - which should a beginner learn?
For a beginner, learning a relational (SQL) database first is the strong, standard recommendation, because relational databases and SQL are the most widely used, the most transferable, and the best foundation - and you can explore other kinds later once you understand the fundamentals. Here's the landscape briefly. Relational databases (often called SQL databases) organise data into tables of rows and columns that relate to each other, and you query them with SQL; they're the traditional, dominant kind, used everywhere from small apps to huge enterprises, and they excel at structured, related data with strong consistency guarantees. Examples you'll hear are PostgreSQL, MySQL, and SQLite (a lightweight file-based SQL database that's excellent for learning and small apps, since it needs no separate server). NoSQL databases are a varied family of non-relational databases that arose for specific needs - some store documents (flexible, JSON-like records), some are key-value stores, some handle specialised data - and they trade some of the relational model's structure and guarantees for things like flexibility or scaling in particular ways; examples include MongoDB (document) and Redis (key-value, often for caching). Why start with relational/SQL? It's the most common, so it's what you're most likely to encounter and be asked about; SQL is a durable, transferable skill that applies across all relational databases and has remained valuable for decades; the relational model (tables and relationships) teaches you fundamental data-modelling concepts that apply broadly, even when you later use other databases; and the querying concepts you've already been practising (filter/sort/select) map directly onto SQL, so it's a natural next step. Relational databases are also a great default for most applications - a common piece of advice is to reach for a relational database unless you have a specific reason not to. A particularly beginner-friendly starting point is SQLite, because it's just a file (no server to set up), speaks standard SQL, and is perfect for learning and small projects, letting you practise real SQL and relational concepts with minimal setup. Once you're comfortable with relational databases and SQL, you'll be well equipped to understand when and why you might reach for a NoSQL database (specific scaling needs, very flexible or unstructured data, particular use cases), and to learn one as needed - but they're better understood after you have the relational foundation, not as a first stop. So the guidance is clear: learn a relational (SQL) database first, ideally starting with something simple like SQLite, focus on the core SQL and the tables-and-relationships model, and treat NoSQL and other specialised databases as things to explore later when you understand the fundamentals and encounter a need for them. SQL and relational thinking are the foundation that makes everything else in the data world easier to pick up, and they're the most valuable, broadly-applicable starting point by a wide margin. The Larz LARZ-701 course goes deeper into databases on exactly this footing.