Edgar F. Codd, a mathematician at IBM, published a paper in 1970 that would go on to quietly change how the modern world stores and retrieves information.

Codd proposed the relational model of data for large shared data banks. It put data into tables of rows and columns and defined a set of mathematical operations for querying those tables.

Several years later, IBM researchers developed a language to implement Codd's ideas. They called it SEQUEL, later shortened to SQL (Structured Query Language), and the world has been using it ever since.

SQL is now over fifty years old. It has outlasted dozens of competing paradigms and survived the rise of the internet. It has also adapted to cloud computing and remains the dominant language for accessing structured data in everything from small startups to multinational financial institutions.

Understanding SQL is one of the most practically useful technical skills an adult professional can acquire, and it is more accessible than most people assume.


What SQL Is and What It Does

SQL (pronounced "sequel" or "S-Q-L" depending on context) is a standardized language for communicating with relational databases.

A relational database is a system that stores data organized into tables: think of a spreadsheet with rows (individual records) and columns (attributes of those records), but with far more power to store millions of rows, enforce data integrity, and query across multiple connected tables simultaneously.

SQL lets you do four broad categories of things with data:

  • Read (retrieve) data from tables
  • Write (insert) new data into tables
  • Modify (update) existing data
  • Delete data

The vast majority of SQL users spend most of their time on the first category - reading and querying data to answer business or analytical questions. This is sometimes called data retrieval or querying, and it is what this article focuses on.

What SQL Is Not

SQL is not a general-purpose language like Python or JavaScript. The language cannot write files to disk, make network requests or build applications by itself. Its purpose is to manipulate and retrieve data.

SQL also does not specify how data is stored internally - that is the job of the database management system (DBMS) that runs the SQL code.

This distinction matters practically: the same SQL query will run on PostgreSQL, MySQL, and Microsoft SQL Server because the language is standardized (though each system has its own extensions and syntax variations). You learn SQL once and apply it across many systems.

The Scale of SQL's Reach

SQL is not just an academic tool or a niche technical skill. The Stack Overflow annual developer survey shows that since the survey began tracking it, including in its 2023 and 2024 reports, SQL has consistently placed among the top five most commonly used languages and technologies across all developer categories.[8]

Among data professionals (analysts, data engineers, and data scientists), SQL regularly ranks as the single most used tool.

In job-posting analyses, SQL comes up time after time as one of the most required skills in analytics roles and often more than Python, R or any visualization tool.

Not only historical momentum but genuine ongoing utility explains why SQL is used to access the data as long as organizations store structured data in relational systems.


The Historical Context: From Codd's Theory to Modern Practice

Edgar Codd and the Relational Model

Edgar F. Codd's 1970 paper "A Relational Model of Data for Large Shared Data Banks," published in Communications of the ACM, was a landmark in computer science.[1]

Databases were navigational at the time and to get data you needed to know precisely where it was stored and how to navigate the data structure. That made applications brittle and tied tightly to how data was physically laid out.

Codd proposed a fundamentally different abstraction. Organize all data as relations (tables) and provide a mathematical set of operations for manipulating them. The physical storage implementation would be hidden from users. They would interact with data through the logical structure alone.

This separation of logical and physical layers is now so taken for granted that it is difficult to appreciate how radical it was in 1970.

SEQUEL to SQL

IBM researchers Donald Chamberlin and Raymond Boyce developed SEQUEL (Structured English Query Language) between 1974 and 1977 as a user-friendly implementation of Codd's relational algebra.[2] The name was later changed to SQL due to a trademark conflict. IBM's initial commercial product was SQL/DS in 1981.

Oracle Corporation (then Relational Software, Inc.) put out the first commercially available SQL-based RDBMS in 1979 (Oracle V2 came out in 1979). It beat IBM's SQL/DS (released in 1981) to market. The race among competitors to implement relational databases helped make SQL the de facto standard before any formal standards body had acted.

The American National Standards Institute (ANSI) published the first SQL standard in 1986, with the ISO standard following in 1987.

"SQL's endurance is a testament to the power of a good abstraction. The relational model maps naturally onto how businesses think about their data, and SQL expresses that model in a language accessible to non-programmers."

adapted from Joe Hellerstein, Readings in Database Systems

The Five Core SQL Clauses, Explained in Plain English

Most SQL queries that analysts and developers write use a small set of core clauses. Understanding what each one does removes most of the mystery.

SELECT and FROM: The Foundation

Every SQL query begins with these two clauses. SELECT specifies which columns you want to retrieve. FROM specifies which table to retrieve them from.

SELECT first_name, last_name, email
FROM customers;

This query returns the first name, last name and email address of every row in the customers table. The semicolon ends the statement.

If you want every column without listing them all:

SELECT *
FROM customers;

All columns get represented by the asterisk as shorthand. Most experienced developers avoid using SELECT * in production code. That is because the query brings back columns you do not need and that makes queries slower and more difficult to grasp.

WHERE: Filtering

Rows get filtered by the WHERE clause. You may want only customers from a specific country or those who signed up after a certain date instead of bringing back all customers.

SELECT first_name, last_name, email
FROM customers
WHERE country = 'Germany'
  AND signup_date > '2023-01-01';

This returns only customers from Germany who signed up after January 1, 2023.

WHERE clauses use comparison operators (=, >, <, >=, <=, !=) and logical operators (AND, OR, NOT) to build conditions.

You can also use IN to match against a list, BETWEEN for ranges and LIKE for pattern matching.

SELECT first_name, last_name
FROM customers
WHERE country IN ('Germany', 'France', 'Netherlands')
  AND email LIKE '%@gmail.com';

ORDER BY: Sorting

The ORDER BY clause controls the order in which results are returned. Results are sorted ascending (A to Z, smallest to largest) by default; add DESC for descending order.

SELECT first_name, last_name, signup_date
FROM customers
ORDER BY signup_date DESC;

This returns all customers sorted by signup date, most recent first.

GROUP BY and Aggregate Functions: Summarizing

With GROUP BY, SQL becomes a real workhorse for analysis. It puts rows sharing the same value in a chosen column into groups so you can run aggregate math across each group.

Aggregate functions include:

  • COUNT() - count of rows
  • SUM() - total of a numeric column
  • AVG() - average of a numeric column
  • MAX() and MIN() - highest and lowest values
SELECT country, COUNT(*) AS customer_count
FROM customers
GROUP BY country
ORDER BY customer_count DESC;

This returns a table showing each country and how many customers are in it, sorted from most to fewest. A query that might take a human analyst hours in a spreadsheet runs in seconds.

After grouping, the HAVING clause puts conditions that are like WHERE but for aggregate results.

SELECT country, COUNT(*) AS customer_count
FROM customers
GROUP BY country
HAVING COUNT(*) > 100
ORDER BY customer_count DESC;

This returns only countries with more than 100 customers.

JOIN: Combining Tables

JOIN is probably the most important concept in relational SQL and real-world data almost never keeps to one table alone. Customers, orders, products and payments could each be a table in a business database. With JOINs, you can bring together information from several tables in one query.

SELECT customers.first_name, customers.last_name, orders.order_date, orders.total_amount
FROM customers
INNER JOIN orders ON customers.customer_id = orders.customer_id
WHERE orders.total_amount > 100;

This query links each order to the customer who placed it using the shared customer_id column. It returns the name, order date and amount for orders over $100.

JOIN typeWhat it returns
INNER JOINOnly rows with matches in both tables
LEFT JOINAll rows from the left table; NULLs where no match in right
RIGHT JOINAll rows from the right table; NULLs where no match in left
FULL OUTER JOINAll rows from both tables; NULLs where no match on either side
CROSS JOINEvery combination of rows from both tables

Of all skills, understanding JOINs most separates basic SQL users from those who are effective. The vast majority of complex questions need to bring data from at least two tables together and most of what makes real-world SQL queries complex lies in the JOIN logic.


Why SQL Has Dominated for Fifty Years

SQL's persistence is not an accident. It has endured because it solves a genuinely hard problem (expressing complex data retrieval operations in human-readable form) and because the relational model it was built on turns out to be a surprisingly good fit for how organizations naturally structure information.

The Relational Model Is a Good Fit for Business Data

Business data most often comes with natural structure built in. Customers have orders, orders have line items, products are in categories and employees report to managers. Relational modeling picks up these relationships naturally and SQL's JOIN operation gives you a way to follow them in queries.

When data is normalized correctly (stored without redundancy, with each fact recorded once), SQL systems are efficient, consistent, and easy to audit.

Database normalization is the process of organizing a database to reduce redundancy and improve data integrity.[3] Codd formalized this through a series of normal forms (1NF through BCNF and beyond), each eliminating specific types of data anomaly.

A well-normalized database ensures that updating a customer's address in one place updates it everywhere - you cannot have conflicting copies of the same fact.

SQL Is Declarative, Not Procedural

SQL tells the database what you want, not how to get it. You do not specify algorithms for searching or sorting; you state your conditions and let the database's query optimizer figure out the most efficient execution plan.

Analysts who are not programmers can write useful SQL queries for this reason. The cognitive model is closer to "ask a question" than to "write an algorithm."

The query optimizer inside a database system like PostgreSQL or Oracle is a sophisticated piece of software. It analyzes your query, examines available indexes and estimates the size of intermediate result sets. Then it chooses an execution plan from among potentially thousands of alternatives.[4]

Users get the benefit of this optimization automatically.

Network Effects and Ecosystem Maturity

Fifty years of use means an enormous ecosystem: training materials, StackOverflow answers, database tools, BI platforms, and application frameworks all speak SQL. Every major relational database (PostgreSQL, MySQL, SQL Server, Oracle, SQLite) uses SQL.

Every major cloud data warehouse (Snowflake, BigQuery, Redshift, Azure Synapse) uses SQL as its primary interface. The cost of replacing this ecosystem is immense, and the alternatives have not provided compelling enough reasons to do so for most use cases.

At the same time, the SQL world has kept moving forward. Today's SQL dialects handle JSON types natively so teams can keep and query semi-structured data right inside a relational database. The window functions introduced in SQL:2003 make analytical math possible that once took procedural code.

These additions have extended SQL's reach into use cases it could not previously serve.


SQL in Practice: Common Use Cases

Business Intelligence and Reporting

Almost every company has analysts writing SQL queries to answer business questions. How many users signed up last month? What is the average order value by product category? Which marketing channel brings in the highest-value customers? Dashboards, reports and ad hoc analyses that inform business decisions run on SQL queries.

Business intelligence platforms (Tableau, Looker, Power BI, Metabase) all generate SQL under the hood when users interact with drag-and-drop interfaces.

When needed, analysts can get around those interfaces using SQL and write more complex logic than drag-and-drop tools allow. They can track down unexpected results by looking at the underlying query and that knowledge lets them bypass those interfaces.

Data Engineering and ETL

ETL, which stands for Extract, Transform and Load, moves data from operational systems into data warehouses via ETL pipelines. For the transformation step that cleans the data, joins it from multiple sources and aggregates it into analytical tables, SQL is the dominant language.

dbt (data build tool) has become the de facto standard for SQL-based data transformation in modern data stacks. It allows data engineers to define transformations as SQL SELECT statements, manage dependencies between transformations, and test data quality - all while maintaining the underlying code in version control.

Application Development

Backend applications use SQL to read and write data persistently. When you log into a website, the application runs a SQL query to verify your credentials. When you place an order, it writes a record to an orders table. SQL is embedded in virtually every non-trivial web application.

Object-relational mappers such as SQLAlchemy for Python, ActiveRecord for Ruby and Hibernate for Java let developers work with databases through object-oriented code instead of raw SQL but underneath they produce SQL.

Developers who understand SQL can diagnose ORM-generated queries that are slow or incorrect, an increasingly common performance and debugging skill.

Data Science

Before applying statistical methods or machine learning models, data scientists draw and ready datasets with SQL. Efficiently writing SQL comes up time after time as a core skill for data science jobs and it is separate from needing to know Python or R.

In many data science workflows, the most time-consuming part of the work is not modeling but data preparation. This includes joining disparate tables, filtering outliers, creating training and test sets and aggregating features.

SQL handles this efficiently and in a way that is auditable and reproducible in ways that ad hoc procedural data manipulation is not.


SQL and NoSQL: Understanding the Distinction

Framed as SQL's potential replacement through the 2000s and 2010s, the rise of NoSQL databases in that period was often presented that way. The reality is more complex.

What NoSQL Solves

NoSQL databases were developed to address specific limitations of relational systems at internet scale.

When companies like Google, Amazon, and Facebook needed to store and serve billions of records with millisecond latency across globally distributed servers, traditional relational databases struggled with the write throughput and horizontal scaling requirements.[6]

Google's Bigtable (Chang et al., 2006) and Amazon's Dynamo (DeCandia et al., 2007), both described in widely cited research papers, established the architectural patterns for NoSQL systems.[5]

These papers documented genuine limitations of relational databases at internet scale and motivated the engineering community to develop alternatives.

In exchange for flexibility and scale, NoSQL databases give up the rigid structure as well as the consistency guarantees of relational systems.

  • Document databases, such as MongoDB, store JSON-like documents with flexible schemas that are useful for content management, user profiles and applications where the data structure changes frequently.
  • Key-value stores (Redis) store data as simple key-value pairs. They are extremely fast and used for caching, session management and real-time leaderboards.
  • Column-family stores (Cassandra) are optimized for time-series data and write-heavy workloads at massive scale.
  • Graph databases (Neo4j) represent data as nodes and edges and that makes them good for social networks, recommendation engines and fraud detection.

What SQL Handles Better

For most business data (transactions, customer records, inventory, financial data), relational databases with SQL remain the better choice. They offer:

  • ACID transactions (Atomicity, Consistency, Isolation, Durability) - guarantees that data is never left in an inconsistent state
  • Powerful querying across multiple related tables
  • Data integrity constraints - foreign keys, unique constraints, check conditions
  • Mature tooling and decades of operational knowledge

The CAP theorem, formalized by Eric Brewer (2000) and later proven by Gilbert and Lynch (2002), demonstrates that distributed systems cannot simultaneously guarantee all three of consistency, availability, and partition tolerance.[7]

Consistency is what NoSQL systems most often give up for availability and partition tolerance and SQL systems put consistency first. Theoretical tradeoff as it is gets mapped to the engineering decisions that practical work demands.

The Practical Reality: Both Are Used

Organizations of meaningful scale most often use both SQL and NoSQL systems and they choose between them based on what each requirement needs.[10]

PostgreSQL could be used by an e-commerce company for its transactional data including orders, inventory and customers. Session data and product listings go into Redis for caching and a data warehouse such as Snowflake (that uses SQL) gets used for analytics. SQL and NoSQL are not competitors and they are complements.

DimensionSQL (relational)NoSQL
Data structureTables with fixed schemasFlexible (documents, key-value, graphs)
Query languageSQL (standardized)Varies by system
TransactionsFull ACID supportOften eventual consistency
ScalingVertical (larger servers)Horizontal (more servers)
Best forStructured business data, complex queriesHigh-volume writes, flexible schemas, specific data models
Maturity50+ years10-20 years for most systems
Analytical capabilityExcellent (especially warehouses)Limited for complex analytics

SQL Career Relevance

Who Uses SQL at Work

SQL is unusual among technical skills in how broadly it is used across roles that do not carry "engineer" or "developer" in their title.

  • Data analysts query databases daily to answer business questions
  • Business intelligence professionals build dashboards and reports powered by SQL
  • Data engineers build pipelines that transform data using SQL
  • Product managers at data-driven companies access metrics directly via SQL
  • Financial analysts at technology companies query financial databases
  • Operations and strategy professionals at data-mature companies pull their own reports
  • Marketing analysts segment audiences, measure campaign performance, and track attribution

Tools like Mode, Looker, Hex and in-browser SQL environments have democratized SQL access. This reduces the technical barrier to running queries. It makes SQL increasingly relevant for roles that were previously dependent on engineering teams to pull data.

Salary and Hiring Data

An enormous range of industries and roles appear in job postings that make SQL a requirement. Data analyst roles that need SQL proficiency through 2023-2024 LinkedIn Insights and Glassdoor salary analysis bring in a meaningful salary premium compared with similar roles that need only spreadsheet skills.

Through 2030, the Bureau of Labor Statistics projects that roles for data analysts and data scientists that both call for SQL will grow substantially faster than average across all occupations.

Data engineering roles command some of the higher salaries in the knowledge economy. SQL is the primary transformation language in these positions. The 2023 Burtch Works compensation study found median compensation for mid-level data engineers in the United States in the range of $130,000-$160,000. SQL is listed as a foundational competency.[9]

How Long It Takes to Learn

Functional proficiency that lets a learner write SELECT, WHERE, GROUP BY and basic JOIN queries can be reached by a motivated learner in about 10 to 20 hours of focused practice.

This is substantially faster than most programming languages, because SQL is declarative, uses familiar English words, and the feedback loop (run a query, see the result) is immediate.

Getting advanced SQL skills such as window functions, CTEs (Common Table Expressions), query optimization and complex multi-table queries takes much longer but any adult who practices on a real dataset can reach basic proficiency. Compared to most technical skills, the investment-to-utility ratio for SQL is especially high.


SQL Concepts Beyond the Basics

Subqueries

A subquery is a SQL query nested inside another query. They allow you to use the result of one query as input to another.

SELECT first_name, last_name
FROM customers
WHERE customer_id IN (
  SELECT customer_id
  FROM orders
  WHERE total_amount > 500
);

Subqueries can appear in the SELECT clause, FROM clause, or WHERE clause. When used in the FROM clause, they are sometimes called derived tables or inline views.

CTEs (Common Table Expressions)

Temporary named result sets are created with the WITH keyword in CTEs and complex queries become easier to read by breaking them into labeled steps that CTEs make possible.

WITH high_value_customers AS (
  SELECT customer_id, SUM(total_amount) AS lifetime_value
  FROM orders
  GROUP BY customer_id
  HAVING SUM(total_amount) > 1000
)
SELECT c.first_name, c.last_name, hvc.lifetime_value
FROM customers c
INNER JOIN high_value_customers hvc ON c.customer_id = hvc.customer_id
ORDER BY hvc.lifetime_value DESC;

CTEs improve readability considerably.

They also make possible recursive CTEs. These can handle hierarchical data such as an organization's reporting structure or a bill-of-materials tree.

Window Functions

Since 2003 with support from all major databases, window functions perform calculations across a set of rows related to the current one without aggregating them into one total. That allows calculations including running totals, rankings and moving averages that needed procedural code before.

SELECT
  first_name,
  last_name,
  total_amount,
  RANK() OVER (ORDER BY total_amount DESC) AS spending_rank,
  SUM(total_amount) OVER () AS all_customers_total,
  total_amount / SUM(total_amount) OVER () AS pct_of_total
FROM orders
INNER JOIN customers USING (customer_id);

Window functions are one of the most powerful additions to SQL in the past two decades and are particularly valued in analytical contexts.

ROW_NUMBER, RANK, LAG, LEAD, SUM OVER, and AVG OVER are among the most commonly used.

Indexes

An index is a data structure that speeds up data retrieval at the cost of storage space and write speed. A database without indexes on frequently queried columns performs full table scans for every query, examining every row, which is slow for large tables.

An index on the customer_id column in an orders table allows the database to jump directly to the relevant rows.

Understanding which columns to index and why is an important part of SQL performance tuning.

As a rule of thumb, put indexes on columns that show up often in WHERE filters, JOIN keys and ORDER BY sorts, skip columns with very few unique values such as boolean flags and be careful indexing write-heavy tables since every insert or update has to update the index too.

Transactions and ACID Properties

SQL databases manage concurrent access and failure recovery through transactions - logical units of work that either complete entirely or are entirely rolled back if something goes wrong.

Financial and transactional systems trust relational databases because of the four ACID guarantees: Atomicity for all-or-nothing runs, Consistency. Data stays valid, Isolation so simultaneous transactions never step on each other and Durability so committed writes stay saved.

BEGIN;
  UPDATE accounts SET balance = balance - 500 WHERE account_id = 1;
  UPDATE accounts SET balance = balance + 500 WHERE account_id = 2;
COMMIT;

If the database crashes between the two UPDATE statements, the transaction is rolled back entirely.

The debit and credit either both happen or neither happens - which is exactly what correctness requires for a financial transfer.


Common Misconceptions About SQL

"SQL is outdated." In reality, the standard has been updated again and again through SQL:1999, SQL:2003, SQL:2011, SQL:2016 and SQL:2023. Modern SQL brings window functions, CTEs, native JSON handling and temporal tables that answer many of the complaints aimed at older versions.

The 2023 standard includes features for property graph queries and multi-dimensional arrays.

"NoSQL databases have replaced SQL." They have not. SQL remains dominant for structured data management, and the major NoSQL databases occupy specific niches rather than displacing relational systems generally. Even some NoSQL databases (like CockroachDB and FaunaDB) have added SQL query interfaces in response to user demand.

"SQL is only for technical people." SQL's declarative, English-like syntax makes it one of the more accessible technical tools available. Many analysts, product managers, and operations professionals without software engineering backgrounds become proficient SQL writers.

"You need to memorize everything." Professional SQL users look things up constantly. Knowing the concepts and structure matters far more than memorizing exact syntax. The ability to read and modify existing queries, understand what a query is doing and debug unexpected results are far more valuable than rote memorization.

"SQL can't handle big data." Today's cloud SQL warehouses, including Snowflake, Google BigQuery, Amazon Redshift and Databricks SQL, crunch through petabytes of data every day.

By using distributed query execution, Snowflake and BigQuery can run analytical queries over billions of rows in seconds. Over the past decade, SQL has become much more applicable to large-scale analytics.


Getting Started With SQL

The fastest way to learn SQL is to practice on real data. Several platforms offer free SQL environments with sample databases:

  • Mode Analytics SQL Tutorial - browser-based, no setup required
  • SQLZoo - interactive exercises with immediate feedback
  • Khan Academy - free beginner-friendly course
  • PostgreSQL + pgAdmin - free, full-featured local setup
  • DBeaver - free universal database client that works with most SQL databases
  • Kaggle SQL courses - free, with integrated notebooks and public datasets

The best practice dataset is data you actually care about. Many analysts report that the moment SQL clicks is when they use it to answer a question they genuinely wanted answered. That is not when they complete a tutorial exercise.

Begin by taking a publicly available dataset from your industry or domain and loading it into a free PostgreSQL instance. Then go through real questions as you work.

SQL has been the language of data for fifty years for good reason. It maps well to how organizations think about information, it is more accessible than most technical tools, and its reach into nearly every data-related career makes learning it one of the highest-return investments of technical time available to a working professional.


Sources & Further Reading

  1. Codd, E. F. (1970). "A relational model of data for large shared data banks." Communications of the ACM, 13(6), 377-387. View source
  2. Chamberlin, D. D., & Boyce, R. F. (1974). "SEQUEL: A structured English query language." Proceedings of the 1974 ACM SIGFIDET Workshop on Data Description, Access and Control, 249-264.
  3. Date, C. J. (2003). An Introduction to Database Systems (8th ed.). Pearson.
  4. Hellerstein, J. M., Stonebraker, M., & Hamilton, J. (2007). Architecture of a Database System. Foundations and Trends in Databases.
  5. Chang, F., et al. (2006). "Bigtable: A distributed storage system for structured data." Proceedings of OSDI 2006.
  6. DeCandia, G., et al. (2007). "Dynamo: Amazon's highly available key-value store." ACM SIGOPS Operating Systems Review, 41(6), 205-220. View source
  7. Brewer, E. (2000). "Towards robust distributed systems." Proceedings of the 19th Annual ACM Symposium on Principles of Distributed Computing (PODC).
  8. Stack Overflow. (2024). Developer Survey 2024..
  9. Burtch Works. (2023). The Burtch Works Study: Salaries and Careers for Analytics, Data Science, and AI/ML Professionals.
  10. Kleppmann, M. (2017). Designing Data-Intensive Applications. O'Reilly Media.