Databases

SQL

SQL is the standard language for querying and managing relational databases using structured tables and relationships.

Diagram

  SELECT name, email FROM users WHERE role = 'admin';
         │              │         │            │
       read cols    from table  filter     condition

In Depth

SQL (Structured Query Language) is the universal language for interacting with relational databases. It defines how to read, insert, update, and delete data stored in tables with rows and columns.

Code Example

Common SQL queries

-- Read with filter and sort
SELECT name, email FROM users WHERE role = 'admin' ORDER BY created_at DESC;

-- Join two related tables
SELECT u.name, o.total FROM orders o
JOIN users u ON o.user_id = u.id;

Related Terms