In SQL (Structured Query Language), commands are categorized into 5 main types based on their functionality.
.png)
1. Data Query Language (DQL)
DQL is used for querying the database and retrieving data.
SELECT: Retrieves data from one or more tables.
SELECT FirstName, LastName
FROM Employees;
2. Data Manipulation Language (DML)
DML commands are used to manipulate data within existing database objects.
INSERT: Adds new records to a table.
INSERT INTO Employees (EmployeeID, FirstName, LastName, Age)
VALUES (1, 'John', 'Doe', 30);
UPDATE: Modifies existing records in a table.
UPDATE Employees
SET Age = 31
WHERE EmployeeID = 1;
DELETE: Removes records from a table.
DELETE FROM Employees
WHERE EmployeeID = 1;
3. Data Definition Language (DDL)
DDL commands are used to define and modify database structures such as schemas, tables, indexes, and views.
CREATE: Creates a new table, view, index, or database.
CREATE TABLE Employees (
EmployeeID int,
FirstName varchar(255),
LastName varchar(255),
Age int
);