0% found this document useful (0 votes)
2 views

SQL Ddl Dml Dcl Commands

The document outlines SQL commands categorized into three types: Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL). DDL commands define and modify database structures, DML commands manipulate data within the database, and DCL commands control access to data. Examples of each command type are provided for clarity.

Uploaded by

alekhayareddy7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL Ddl Dml Dcl Commands

The document outlines SQL commands categorized into three types: Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL). DDL commands define and modify database structures, DML commands manipulate data within the database, and DCL commands control access to data. Examples of each command type are provided for clarity.

Uploaded by

alekhayareddy7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL Commands: DDL, DML, DCL

1. Data Definition Language (DDL)

1. Data Definition Language (DDL):

DDL commands are used to define and modify the structure of database objects such as tables, indexes, and

schemas.

Common DDL Commands:

- CREATE: To create new tables or databases.

- ALTER: To modify existing table structures.

- DROP: To delete tables or databases.

- TRUNCATE: To remove all records from a table without logging individual row deletions.

Examples:

CREATE TABLE Students (

StudentID INT,

Name VARCHAR(50),

Age INT

);

ALTER TABLE Students ADD Email VARCHAR(100);

DROP TABLE Students;

2. Data Manipulation Language (DML)

2. Data Manipulation Language (DML):


SQL Commands: DDL, DML, DCL

DML commands are used to manipulate data stored in the database. They allow inserting, updating, deleting,

and retrieving data.

Common DML Commands:

- INSERT: To add new records.

- UPDATE: To modify existing records.

- DELETE: To remove records.

- SELECT: To retrieve data.

Examples:

INSERT INTO Students (StudentID, Name, Age) VALUES (101, 'Alice', 21);

UPDATE Students SET Age = 22 WHERE StudentID = 101;

DELETE FROM Students WHERE StudentID = 101;

SELECT * FROM Students;

3. Data Control Language (DCL)

3. Data Control Language (DCL):

DCL commands are used to control access to data in the database. They deal with permissions and access

rights.

Common DCL Commands:


SQL Commands: DDL, DML, DCL

- GRANT: To give privileges to users.

- REVOKE: To remove privileges from users.

Examples:

GRANT SELECT, INSERT ON Students TO user1;

REVOKE INSERT ON Students FROM user1;

You might also like