← DBMS & SQL learning path
DBMS & SQL · Module 3 of 10

Creating tables: DDL

Define structure with CREATE, ALTER and DROP.

📖 Key ideas

  1. DDL (Data Definition Language) defines structure.
  2. CREATE TABLE students (id INT PRIMARY KEY, name VARCHAR(50));
  3. ALTER TABLE adds or changes columns.
  4. DROP TABLE deletes the whole table; TRUNCATE removes all rows but keeps the table.
  5. Data types: INT, VARCHAR(n), DATE, DECIMAL(p,s), BOOLEAN.
💡 Real-life example: DDL is the architect's plan: rooms (tables) and their sizes (columns) are designed before people move in.
CREATE TABLEMakes a new table
ALTER TABLEChanges a table structure
DROP TABLEDeletes a table completely
VARCHAR(n)Text up to n characters