← DBMS & SQL learning pathDBMS & SQL · Module 3 of 10
Creating tables: DDL
Define structure with CREATE, ALTER and DROP.
📖 Key ideas
- DDL (Data Definition Language) defines structure.
- CREATE TABLE students (id INT PRIMARY KEY, name VARCHAR(50));
- ALTER TABLE adds or changes columns.
- DROP TABLE deletes the whole table; TRUNCATE removes all rows but keeps the table.
- 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