ICT INDIVIDUAL ASSIGNMENT
⇒ The difference between DDL,DML,DQL and their operation
Definition
1. Data Definition Language (DDL)
DDL consists of SQL commands used to define and manage database objects (such as
tables, schemas, and indexes). It deals with the structure of the database.
2. Data Manipulation Language (DML)
DML includes SQL commands that allow for the manipulation of data within database
tables. It is used to insert, update, delete, or retrieve data.
3. Data Query Language (DQL)
DQL refers to SQL commands used specifically for querying and retrieving data from a
database. It does not alter the data but allows users to view it.
Differences
Purpose:
DDL: Defines and manages the structure of database objects.
DML: Manipulates the data within database objects.
DQL: Retrieves data from the database.
Actions:
DDL: Creates, alters, or deletes database structures.
DML: Modifies or manages the actual data (insert, update, delete).
DQL: Selects and queries data without modifying it.
Effect on Database:
DDL: Changes the schema or structure of the database.
DML: Changes the contents of the database (data).
DQL: No effect on data or schema, only retrieves data.
Usage:
DDL: Used by DB administrators to define database structures.
DML: Used by users and applications to manipulate the data.
DQL: Used for querying and fetching data by users or applications.
Operations
Here are the operations of Data Definition Language (DDL), Data Manipulation Language
(DML), and Data Query Language (DQL):
1. Data Definition Language (DDL) Operations:
CREATE: Creates new database objects such as tables, views, schemas, etc.
ALTER: Modifies the structure of an existing database object.
DROP: Deletes an existing database object like a table, view, or index.
TRUNCATE: Removes all rows from a table, but keeps the table structure intact.
RENAME: Renames an existing database object.
2. Data Manipulation Language (DML) Operations:
INSERT: Adds new records or rows into a table.
UPDATE: Modifies existing records in a table.
DELETE: Removes records from a table.
MERGE: Combines data from two tables, often used for insert/update based on a
condition.
3. Data Query Language (DQL) Operations:
SELECT: Retrieves data from one or more tables based on specified conditions.
Example: SELECT column1, column2 FROM table WHERE condition
Produced by Kaleab Yekoye(22)