DDL
DDL is an abbreviation for data definition language used to define, modify, and manage the structure of a database.
Common DDL commands
Create - Creates a new table, database, index, or view
Example
Alter
Used to modify the exiting table
Alter can be used to:
Remove column
Add column
Truncate – it empties all rows from a table but keeps its structure
truncate table safari.student;
DML
DML is an abbreviation for data manipulation language,
These are the commands that work with the actual data stored inside tables exmple adding rows, reading rows, updating values, and deleting rows.
Example of commands
Select reads data from one or more tables
Example:
2.Insert
Adds new rows to a table
- Update Is used to modifies existing rows. example
- Delete is used to removes rows from a table
Diffence
The main difference: DDL defines and changes the structure of a table using commands like CREATE, ALTER, DROP while DML works with the actual data inside that structure commands like SELECT, INSERT, UPDATE, DELETE.
Top comments (0)