Database Design   «Prev  Next»

Lesson 6 Structured Query Language
Objective Why is SQL the common language of relational databases?

Why SQL Is the Common Language of Relational Databases

A practical view of SQL as the interface to relational data
Relational databases store information in tables and link those tables through keys. SQL (Structured Query Language) became the common language for relational databases because it gives a consistent way to:
  1. Define the structure of tables, keys, and constraints.
  2. Manipulate data by inserting, updating, deleting, and querying rows.
  3. Join related tables to answer business questions without writing low-level navigation code.
In other words, SQL is the bridge between the relational model (tables, rows, and columns) and the questions people ask about data.

SQL is both DDL and DML

SQL is widely adopted because a single language covers two essential roles:

1) Data Definition Language (DDL)
DDL statements describe and create database structures, such as:
  1. Create and drop tables.
  2. Modify tables (add, remove, or change columns).
  3. Create and drop views.
  4. Define constraints (PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, CHECK).

2) Data Manipulation Language (DML)
DML statements work with the rows inside those structures:
  1. Query data (SELECT).
  2. Insert new rows (INSERT).
  3. Change existing rows (UPDATE).
  4. Remove rows (DELETE).

A practical takeaway is that you can use SQL to build a schema and then use SQL to work with the data that schema stores—without switching languages.

Example table: Employees

The figure below shows a simple relational table. Notice the pattern:
  • A table represents one subject (employees).
  • Columns represent fields (LastName, FirstName, HireDate).
  • Rows represent records (one employee per row).
  • A primary key uniquely identifies each record (EmpID).

Practical SQL
Employees table containing 1) primary key EmpID 2) fields a) LastName, b) FirstName, c)HireDate
Employees table with a primary key (EmpID) and three descriptive fields.
| EmpID | LastName  | FirstName | HireDate   |
| ----: | --------- | --------- | ---------- |
| 77920 | Jackson   | Stephen   | 11-29-1997 |
| 77921 | Reynolds  | Sandy     | 01-04-1993 |
| 77922 | Armstrong | Stephen   | 09-16-1989 |
| 77823 | Jackson   | Linda     | 10-09-1996 |

DDL example: Creating a table with a primary key

A CREATE TABLE statement defines the table shape (columns + datatypes) and can also define constraints such as a primary key. This is one reason SQL is the common language: the “data blueprint” is expressed in a portable, declarative form.
SQL statements
SQL DDL for creating the Employees table and declaring EmpID as the primary key.
CREATE TABLE Employees (
  EmpID     NUMERIC,
  LastName  VARCHAR(20),
  FirstName VARCHAR(15),
  HireDate  DATE,
  PRIMARY KEY (EmpID)
);
The statement defines:
  1. Table name: Employees
  2. Columns: EmpID, LastName, FirstName, HireDate
  3. Datatype rules: numeric, varchar, date
  4. Constraint: EmpID must be unique (PRIMARY KEY)

DML example: Asking questions of the data

SQL also acts as the common language because it lets you retrieve and shape results using a consistent pattern:
SELECT EmpID, LastName, HireDate
FROM Employees
WHERE HireDate < DATE '2000-01-01'
ORDER BY HireDate;
SQL is declarative: you describe what you want, and the database engine decides how to execute the query efficiently. That separation is a key reason SQL scales from small tables to enterprise systems.

Why SQL works across different database products

SQL is standardized and widely implemented, so core concepts transfer between platforms. Even though vendors support dialect differences (datatypes, functions, tooling), the fundamentals remain consistent:
  • Tables, rows, columns, keys, and constraints.
  • DDL to define schema.
  • DML to query and modify data.
  • Joins and set operations to combine data across tables.
This ecosystem effect matters: tools, libraries, ORMs, reporting platforms, and analytics products commonly assume SQL as the interface.

Practical note on SQL dialects

SQL comes in dialects, which means some syntax details vary between database engines. When learning SQL, focus first on the portable core (SELECT, WHERE, JOIN, GROUP BY, INSERT/UPDATE/DELETE, CREATE TABLE, constraints). Vendor-specific features can be layered on later as you specialize.

Summary: SQL is the common language of relational databases because it gives a single, consistent way to define relational structures (DDL), manipulate relational data (DML), and query across linked tables using a declarative style that scales. In the next lesson you will continue building on SQL as the core interface to an RDBMS.

[1](DDL) data definition language: SQL statements that define database objects and metadata (tables, constraints, views, and schema changes).
[2](DML) data manipulation language: SQL statements that query and change the rows stored in database tables.

SEMrush Software 6 SEMrush Banner 6