Okay, you've learned how relational databases organize information into neat tables with rows and columns, using primary and foreign keys to establish structure and relationships. That's a great foundation. But how do you actually interact with that data? How do you ask the database questions, add new information, or correct mistakes?
The answer is Structured Query Language, universally known as SQL (often pronounced "sequel" or simply as S-Q-L).
Think of SQL as the special language you use to communicate with a relational database management system (DBMS). Just like you use English or Spanish to talk to another person, you use SQL to talk to your database. It's the standard way to tell the database what you want it to do with the data it holds.
SQL stands for Structured Query Language. Let's break that down:
Imagine your database is a vast, meticulously organized warehouse, and the DBMS is the warehouse manager. SQL is the set of instructions you give to the manager: "Find all boxes labeled 'Customer Orders' from last week," "Add this new item to Shelf 3B," or "Update the location of item X."
SQL was first developed in the 1970s and has since become an official standard recognized by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO). This standardization is incredibly useful because it means the fundamental commands work similarly across different relational database systems.
However, while the core language is standard, most specific database systems (like PostgreSQL, MySQL, Microsoft SQL Server, Oracle Database, SQLite) add their own proprietary extensions and variations to the standard SQL syntax. Think of it like dialects of a spoken language – people from different regions might use slightly different words or phrasing, but the core language remains understandable. For the basic operations covered in this course (SELECT
, INSERT
, UPDATE
, DELETE
), the syntax is remarkably consistent across most popular databases.
SQL commands can be broadly grouped based on their function. While you don't need to memorize these categories right now, seeing them helps understand the scope of SQL:
SELECT
, which you'll use extensively to ask the database for specific information.INSERT
), modifying existing data (UPDATE
), and removing data (DELETE
).CREATE TABLE
, ALTER TABLE
, and DROP TABLE
fall into this category. These commands build the "containers" for your data.GRANT
(give permissions) and REVOKE
(remove permissions) belong here.In this chapter, our main focus will be on DQL (using SELECT
to get data) and DML (using INSERT
, UPDATE
, DELETE
to change data), as these are the fundamental operations for working with the information stored inside your tables.
Now that you know what SQL is and its purpose, we're ready to start learning the actual commands. We'll begin with the most common operation: retrieving data using the SELECT
statement.
© 2025 ApX Machine Learning