DBMS Topics
SQL Introduction
Last Updated : 21 May, 2026
SQL Structured Query Language is the standard language for interacting with relational databases. It allows users to define, manipulate, and control data in a relational
What is SQL?
SQL (Structured Query Language) is the standard language for interacting with relational databases. It allows users to define, manipulate, and control data in a relational database system.
SQL was developed at IBM by Donald Chamberlin and Raymond Boyce in the early 1970s (originally called SEQUEL). It became an ANSI standard in 1986 and an ISO standard in 1987.
History of SQL
| Year | Milestone |
|---|---|
| 1970 | E.F. Codd proposes the relational model |
| 1974 | SEQUEL developed at IBM (later renamed SQL) |
| 1979 | Oracle releases first commercial SQL database |
| 1986 | SQL-86: First ANSI/ISO SQL standard |
| 1989 | SQL-89 (minor revision) |
| 1992 | SQL-92 (SQL2) — major update, widely supported |
| 1999 | SQL-99 (SQL3) — added procedural features, triggers |
| 2003 | SQL:2003 — added XML features, window functions |
| 2011 | SQL:2011 — temporal data support |
| 2016 | SQL:2016 — JSON support |
| 2023 | SQL:2023 — property graph queries |
SQL vs. Relational Algebra/Calculus
| Relational Algebra | Procedural | How to get data |
| Relational Calculus | Declarative | What data to get |
| SQL | Declarative | Based on calculus, with procedural extensions |
SQL is relationally complete — any query expressible in relational algebra can be expressed in SQL.
Categories of SQL Commands
| DDL | CREATE, ALTER, DROP, TRUNCATE, RENAME |
| DML | SELECT, INSERT, UPDATE, DELETE |
| DCL | GRANT, REVOKE |
| TCL | COMMIT, ROLLBACK, SAVEPOINT |
SQL Data Types
Numeric Types
| Type | Description | Example |
|---|---|---|
| INT / INTEGER | Whole numbers | 42, -10 |
| BIGINT | Large integers | 9999999999 |
| SMALLINT | Small integers | 1-100 |
| DECIMAL(p, s) | Fixed precision | 9.99 |
| FLOAT / DOUBLE | Floating point | 3.14159 |
String Types
| Type | Description |
|---|---|
| CHAR(n) | Fixed-length string (padded with spaces) |
| VARCHAR(n) | Variable-length string (up to n characters) |
| TEXT | Large text (no length limit) |
Date and Time Types
| Type | Description | Example |
|---|---|---|
| DATE | Date only | '2024-01-15' |
| TIME | Time only | '14:30:00' |
| DATETIME | Date and time | '2024-01-15 14:30:00' |
| TIMESTAMP | Date+time with timezone | Automatic recording |
Other Types
| Type | Description |
|---|---|
| BOOLEAN | TRUE / FALSE |
| BLOB | Binary large object (images, files) |
| ENUM | One value from a predefined list |
Basic SQL Query Structure
Query Execution Order (Logical)
Note: This is the logical order (how SQL thinks), not necessarily the physical execution order chosen by the optimizer.
A Simple Complete Example
-- Create a table
CREATE TABLE Student (
student_id INT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
dept VARCHAR(50),
gpa DECIMAL(3, 2)
);
-- Insert data
INSERT INTO Student VALUES (1, 'Alice', 'CS', 9.2);
INSERT INTO Student VALUES (2, 'Bob', 'Math', 8.5);
INSERT INTO Student VALUES (3, 'Carol', 'CS', 9.5);
-- Query data
SELECT name, gpa
FROM Student
WHERE dept = 'CS'
ORDER BY gpa DESC;
-- Result:
-- +-------+-----+
-- | name | gpa |
-- +-------+-----+
-- | Carol | 9.5 |
-- | Alice | 9.2 |
-- +-------+-----+SQL vs. Other Languages
| Feature | SQL | Python/Java |
|---|---|---|
| Paradigm | Declarative | Imperative |
| Specifies | WHAT to get | HOW to get it |
| Set-based | Yes (works on sets) | No (loop-based) |
| Built for | Data management | General purpose |
| Learning curve | Low (English-like) | Medium-High |
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for SQL Introduction.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this DBMS topic.
Search Terms
dbms, database management system, database notes, sql, unit, introduction, sql introduction
Related DBMS Topics