| Category | Full Name | Purpose | Core SQL Commands |
|---|---|---|---|
| DDL | Data Definition Language | Defines, alters, and destroys database structure and schemas. (Auto-commits!) | `CREATE`, `ALTER`, `DROP`, `TRUNCATE` |
| DML | Data Manipulation Language | Inserts, updates, and deletes data records inside existing tables. | `INSERT`, `UPDATE`, `DELETE` |
| DQL | Data Query Language | Retrieves data records from tables without modifying data. | `SELECT` |
| TCL | Transaction Control Language | Manages database transaction states and ACID integrity. | `COMMIT`, `ROLLBACK`, `SAVEPOINT` |
Table Constraints
Rules enforced on columns to ensure data validity and referential integrity:
- `PRIMARY KEY`: Uniquely identifies each row (implies `UNIQUE` and `NOT NULL`).
- `FOREIGN KEY...REFERENCES`: Enforces referential integrity pointing to a parent table primary key.
- `NOT NULL`: Forbids column from holding missing/NULL values.
- `UNIQUE`: Ensures all column values are distinct (allows NULLs).
- `CHECK`: Validates an algebraic condition (e.g., `CHECK (Price > 0)`).
- `DEFAULT`: Assigns a fallback value when none is supplied (e.g., `DEFAULT 'Active'`).