Everything you need to know about SQL
SQL (Structured Query Language, .sql) is the standard query language for relational databases - created at IBM in the 1970s, standardized as ISO/IEC 9075. Despite countless attempts to replace it, SQL remains the dominant way to talk to databases 50 years later. Every modern database (PostgreSQL, MySQL, SQLite, BigQuery, Snowflake) speaks SQL.
How it works under the hood
- Declarative. You describe WHAT you want, the database engine figures out HOW. The optimizer translates SQL into an execution plan that may be wildly different from how you wrote it.
- Set-based thinking. SQL operates on sets of rows, not loops. `SELECT * FROM users WHERE age > 18` returns ALL matching rows in one operation.
- JOINs. INNER, LEFT, RIGHT, FULL OUTER, CROSS - each combines rows from two tables in different ways. Mastering joins is the difference between intermediate and senior data engineers.
- ACID guarantees. Atomicity, Consistency, Isolation, Durability. Real SQL databases promise all four for transactions - which is why fintech still runs on Postgres.
Where you'll actually use it
- Application backends (every CRUD app has a SQL database underneath)
- Data analysis and reporting
- ETL pipelines and data warehousing
- BI tools (Tableau, Looker, Metabase all use SQL underneath)
How it compares to alternatives
SQL vs NoSQL (MongoDB): SQL has strong schemas and JOINs; NoSQL scales horizontally easier. Modern Postgres has JSON columns - blurring the line. SQL vs ORMs: ORMs (Prisma, SQLAlchemy) generate SQL - useful for simple queries, but raw SQL beats them for complex ones.
Things that will trip you up
- SQL injection is THE classic vulnerability - always use parameterized queries, never string concatenation
- `SELECT *` in production code is a smell - lists explicit columns for stability when schema changes
- Different databases have different SQL dialects - PostgreSQL `LIMIT` vs SQL Server `TOP` vs Oracle `ROWNUM`