Chapter 01 · Data, Databases, DBMSs, and SQL
What Are Data, Databases, DBMSs, and SQL?
Separate four terms that beginners often treat as synonyms, understand how a database request flows through a DBMS, and create your first small relational database with SQLite.
Learning outcomes
By the end of this lesson, you should be able to distinguish the information itself from the software that manages it. This distinction becomes essential later: Hadoop is not “the data,” Spark is not “a database,” and SQL is not a database product.
Define data, database, DBMS, and SQL without using the terms interchangeably.
Describe the path from a SQL statement to stored records and a result set.
Recognize why a relational table needs structure, types, keys, and constraints.
Create, populate, and query a small SQLite database.
Four terms, four different responsibilities
Data
Recorded facts or observations: a name, timestamp, sensor value, image, event, document, or relationship.
Database
An organized collection of related data, stored so that it can be retrieved, changed, protected, and maintained.
DBMS
The database management system: software that defines, stores, queries, secures, coordinates, backs up, and recovers databases.
SQL
A declarative language used to define, query, modify, control, and transact with relational data.
A database is therefore not the same thing as a DBMS. The file
academy.db can be a database. SQLite is the DBMS
library and command-line program that interprets requests and
manages that file. A statement such as
SELECT full_name FROM learners; is SQL.
Data is what you know. A database is the organized collection. A DBMS is the managing software. SQL is one language used to communicate intent to a relational DBMS.
Why databases exist
A text file can store data. A spreadsheet can organize rows and columns. Neither automatically provides all the guarantees expected from a database system. As data becomes shared, valuable, concurrent, or large, the system must answer harder questions:
- How do multiple users update records without corrupting one another’s work?
- How do we prevent an order from referring to a customer that does not exist?
- How do we find a few matching records without scanning every byte?
- How do we recover after a crash, disk failure, mistaken update, or security incident?
- Who is permitted to read salary data, change inventory, or delete an account?
A DBMS packages mechanisms for these concerns: schemas, constraints, transactions, indexes, query optimization, privileges, logs, backups, replication, and recovery. Different systems emphasize different workloads, but the underlying engineering problems recur throughout this academy.
| Tool | Good at | Typical limitation |
|---|---|---|
| Text file | Simple exchange and inspection | No built-in integrity, concurrency, or query planning |
| Spreadsheet | Interactive personal analysis | Weak multi-user control and reproducible schema enforcement |
| DBMS | Shared, governed, queryable, durable data | Requires design, operations, and resource management |
How a database request flows
SQL is declarative: you describe the result or change you want, rather than manually specifying every storage operation. The DBMS parses the statement, verifies names and permissions, chooses an execution strategy, accesses storage, and returns a result or confirmation.
A result set or error travels back in the opposite direction.
In a client-server system such as PostgreSQL, the client and DBMS server can run on different machines. In an embedded system such as SQLite, the DBMS library runs inside the application process. The responsibilities still exist even though the deployment shape changes.
The relational idea
A relational database represents data through relations. In practical SQL systems, a relation is usually presented as a table. A relation schema can be written as \(R(A_1, A_2, \ldots, A_n)\), where \(R\) is the relation name and each \(A_i\) is an attribute. A row is a tuple containing one value for each attribute.
For a table named learners, we might define:
The number of rows is the relation’s cardinality; the number of attributes is its degree. SQL implementations add practical features such as ordering of displayed columns, vendor data types, indexes, and storage engines, but the relational model provides the conceptual foundation.
| learner_id | full_name | joined_on | |
|---|---|---|---|
| 1 | Mina Karimi | mina@example.org | 2026-08-01 |
| 2 | Omar Haddad | omar@example.org | 2026-08-02 |
Its columns have declared meaning, its values follow domains or data types, keys identify rows, and constraints reject invalid states. The structure is executable documentation.
What SQL can express
SQL is frequently introduced only as a query language, but it covers several families of responsibility:
- Data definition: create or alter schemas, tables, constraints, views, and indexes.
- Data querying: project, filter, join, aggregate, sort, and combine result sets.
- Data modification: insert, update, delete, and merge records.
- Transaction control: commit, roll back, and establish transaction boundaries.
- Access control: grant and revoke privileges in systems that support these statements.
SQL is standardized, but products implement dialects. PostgreSQL, MySQL, SQL Server, Oracle, SQLite, BigQuery, Spark SQL, HiveQL, and Trino SQL overlap substantially while differing in types, functions, administrative syntax, and advanced features. This course teaches the portable core and labels dialect-specific behavior explicitly.
First lab: create a database with SQLite
SQLite is used for the first labs because it is free, small, cross-platform, and requires no server administration. You will later repeat and extend these concepts in MySQL and PostgreSQL.
1. Open the database
# Verify SQLite is installed.sqlite3 --version# Open or create a database file.sqlite3 academy.db-- Inside the SQLite prompt:.headers on.mode box
The command creates academy.db if it does not
already exist. SQLite’s dot commands such as
.headers configure the CLI; they are not SQL and
will not work in every database client.
2. Define a table and insert rows
-- Create a table that stores learners.CREATE TABLE learners ( learner_id INTEGER PRIMARY KEY, full_name TEXT NOT NULL, email TEXT NOT NULL UNIQUE, joined_on DATE NOT NULL);INSERT INTO learners (full_name, email, joined_on)VALUES ('Mina Karimi', 'mina@example.org', '2026-08-01'), ('Omar Haddad', 'omar@example.org', '2026-08-02');
The table definition already expresses useful rules. A learner must have a name, email, and joining date. Email values must be unique. The integer primary key identifies each row.
3. Query the data
SELECT learner_id, full_name, joined_onFROM learnersWHERE joined_on >= '2026-08-02'ORDER BY joined_on DESC;
The DBMS should return only Omar Haddad’s row. The query names the required columns, identifies the source table, filters rows, and specifies output ordering. Later chapters analyze every clause in detail.
Read the query as a sentence: “Select these columns from learners where the joining date is at least August 2, ordered from newest to oldest.” SQL becomes easier when each clause has a clear role.
Database system versus big-data system
Traditional database systems and big-data frameworks overlap, but they are not interchangeable. PostgreSQL can store and analyze substantial datasets. Spark can query structured data using SQL. Kafka durably stores event streams. Hadoop provides distributed storage and resource-managed computation. The correct category depends on the workload and guarantees, not simply the number of gigabytes.
As the academy progresses, evaluate every technology using a stable set of questions:
- What data model does it expose?
- What workloads is it optimized for?
- How does it partition, replicate, and recover data?
- What consistency and transaction guarantees does it provide?
- How is it queried, secured, observed, and operated?
- What simpler system could solve the same problem?
Common beginner misconceptions
“SQL is Microsoft SQL Server.”
SQL is a language family and standard. SQL Server is one DBMS product whose primary dialect is T-SQL.
“NoSQL means no SQL can ever be used.”
The term usually means non-relational or “not only SQL.” Some non-relational systems expose SQL-like query interfaces.
“A database is just a table.”
A database can contain many schemas and objects: tables, indexes, views, constraints, routines, metadata, permissions, logs, and more.
“Big data begins when a file becomes large.”
Scale is contextual. Big-data architectures become relevant when volume, velocity, variety, distribution, or operational requirements exceed a simpler system’s practical limits.
Checkpoint and practice
Concept check
- Is PostgreSQL data, a database, a DBMS, or SQL?
-
What is the difference between
sqlite3andacademy.db? - Why can a DBMS reject a row before storing it?
- Why is SQL described as declarative?
Review the answers
PostgreSQL is a DBMS. sqlite3 is a DBMS
program; academy.db is a database file.
Constraints and types allow the DBMS to reject invalid
states. SQL states the desired result or change while the
DBMS chooses a physical execution strategy.
Hands-on exercise
- Add a third learner.
- Query only names and email addresses.
- Filter for rows before a chosen date.
- Attempt to insert a duplicate email and record the error.
-
Use
.schema learnersto inspect the definition.
Summary and next lesson
You now have the vocabulary required for the rest of the academy. Data is the recorded information. A database is an organized collection. A DBMS is the software that manages databases and their guarantees. SQL is a declarative language used primarily with relational systems. The next lesson classifies structured, semi-structured, and unstructured data and explains why format and schema shape every later technology choice.
References
- ISO/IEC 9075 — SQL language standard family.
- E. F. Codd, “A Relational Model of Data for Large Shared Data Banks,” 1970.
- SQLite documentation — SQL language and command-line shell.
- PostgreSQL documentation — SQL language concepts and database terminology.