Study Atlas › Computer Science › Databases

Relational databases and SQL

Data stored in tables (relations) and queried with a declarative language, SQL.

Edited by Alex C, EduAlx · Sources cited below

Explanation

E. F. Codd proposed the relational model at IBM (1970, Turing Award 1981). Normalisation reduces redundancy. ACID properties (atomicity, consistency, isolation, durability) guarantee reliable transactions. SQL was developed at IBM (Chamberlin and Boyce). NoSQL stores trade some guarantees for scale.

Example

SELECT name FROM customers WHERE country = 'India' ORDER BY name;

Code

SELECT c.name, SUM(o.amount) AS total
FROM customers c
JOIN orders o ON o.customer_id = c.id
GROUP BY c.name
HAVING SUM(o.amount) > 10000;

How it works, step by step

  1. Design tables and keys
  2. Normalise to remove redundancy
  3. Write declarative SQL queries
  4. Query optimiser picks an execution plan
  5. Transactions keep data consistent

Open the interactive page with diagrams →

People behind it

References

  1. E. F. Codd, Commun. ACM 1970, 13, 377–387.
  2. D. D. Chamberlin, R. F. Boyce, Proc. ACM SIGFIDET 1974, 249–264.

Textbooks

Related topics

Computer networks and the TCP/IP modelConcurrency: deadlock and synchronisationWorld Wide Web, HTTP and HTMLOperating systems: processes, scheduling and memoryInformation theory and entropyVon Neumann architecturePublic-key cryptography (Diffie–Hellman, RSA)Boolean logic and digital circuitsProgramming paradigmsP versus NP