DDL(Data Definition Language) and DML(Data Manipulation Language) are two important subsets of SQL (Structured Query Language), each serving different purposes in database management.
- DDL
- CREATE: To create new tables or databases.
CREATE TABLE Employees (
ID INT PRIMARY KEY,
Name VARCHAR(100),
Position VARCHAR(50)
);
- ALTER: To modify existing database structures (e.g., adding or dropping columns).
ALTER TABLE table_name
ADD column_name data_type;
- DROP: To delete tables or databases.
DROP TABLE table_name;
DML
- SELECT: To query and retrieve data.
SELECT column1, column2, ...
FROM table_name;
- INSERT: To add new records to a table.
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);
- UPDATE: To modify existing records.
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
- DELETE: To remove records from a table.
DELETE FROM table_name
WHERE condition;
Top comments (0)