Junior — Middle
What is the difference between data definition operations and data manipulation operations in SQL?
sobes.tech AI
Answer from AI
SQL operations are divided into two main categories:
-
Data Definition Language (DDL) — commands that create, modify, or delete the structure of a database. For example:
- CREATE (creating tables, databases)
- ALTER (modifying table structures)
- DROP (deleting tables or databases)
-
Data Manipulation Language (DML) — commands that work with the contents of tables, i.e., the data itself. For example:
- SELECT (reading data)
- INSERT (adding new records)
- UPDATE (updating existing records)
- DELETE (removing records)
Thus, DDL manages the database structure, while DML manages the data.