SQL Practice Logo

SQLPractice Online

What is a Relational Database?: Functions

Module: Foundational Concepts

CUSTOMERS table:

customer_id | name | email

1 | John Smith | john@example.com

2 | Jane Doe | jane@example.com

ORDERS table:

order_id | customer_id | total

101 | 1 | 150.00

102 | 1 | 200.00

Relationship: orders.customer_id references customers.customer_id

Tables hold one structured entity type using rows and columns.

Primary keys identify each row uniquely.

Foreign keys connect related tables safely.

SQL retrieves and combines related data through joins.

Transactions keep multi-step writes consistent.

Strong standards compliance, rich SQL features, and excellent transactional behavior.

Popular in web applications, pragmatic operational model, and broad hosting support.

Enterprise-oriented platform with deep Microsoft ecosystem support.

Longstanding enterprise database with strong transactional and procedural tooling.

This topic is concept-first. Focus on the core building blocks that make relational systems trustworthy: tables, rows, columns, keys, and transactions.

Table

Stores one entity type in a consistent structure so every row follows the same business schema.

customers(customer_id, name, email)

Good relational design gives each table one clear responsibility.

Row

Represents one record inside a table, such as one customer, one order, or one product.

customer_id = 101, name = Alice Johnson

Rows are the individual business facts you query, update, and join.

Column

Represents one attribute shared across every row in the table, such as email, order_date, or salary.

email VARCHAR(255)

Columns define what kind of fact each row is allowed to store.

PRIMARY KEY

Uniquely identifies each row and implicitly requires NOT NULL.

customer_id INT PRIMARY KEY

FOREIGN KEY

Enforces referential integrity by requiring a matching row in another table.

FOREIGN KEY (department_id) REFERENCES departments(department_id)

Transaction

Groups multiple writes into one safe unit so the database can commit all changes together or undo them together.

BEGIN; ... COMMIT;