SlideShare a Scribd company logo
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 SQL language is divided into four types of
primary language statements: DML, DDL,
DCL andTCL. Using these statements, we can
define the structure of a database by creating
and altering database objects, and we can
manipulate data in a table through updates
or deletions.We also can control which user
can read/write data or manage transactions
to create a single unit of work.
 1. DML (Data Manipulation Language)
2. DDL (Data Definition Language)
3. DCL (Data Control Language)
4. TCL (Transaction Control Language)
 5. DRL
 DML statements affect records in a table.These
are basic operations we perform on data such as
selecting a few records from a table, inserting
new records, deleting unnecessary records, and
updating/modifying existing records.
 DML statements include the following:
 SELECT – select records from a table
INSERT – insert new records
UPDATE – update/Modify existing records
DELETE – delete existing records
 INSERT - insert data into a table
 UPDATE - updates existing data within a
table
 DELETE - deletes all records from a table, the
space for the records remain
 MERGE - UPSERT operation (insert or
update)
 CALL - call a PL/SQL or Java subprogram
 EXPLAIN PLAN - explain access path to data
 LOCKTABLE - control concurrency
 DDL statements are used to alter/modify a
database or table structure and schema.
These statements handle the design and
storage of database objects.
 CREATE – create a newTable, database,
schema
ALTER – alter existing table, column
description
DROP – delete existing objects from
database
 CREATE - to create objects in the database
 ALTER - alters the structure of the database
 DROP - delete objects from the database
 TRUNCATE - remove all records from a table,
including all spaces allocated for the records
are removed
 COMMENT - add comments to the data
dictionary
 RENAME - rename an object
 DCL statements control the level of access
that users have on database objects.
GRANT - gives user's access privileges to
database
GRANT – allows users to read/write on certain
database objects
REVOKE - withdraw access privileges given
with the GRANT command
REVOKE – keeps users from read/write
permission on database objects
 TCL statements allow you to control and
manage transactions to maintain the
integrity of data within SQL statements.
 BEGINTransaction – opens a transaction
COMMITTransaction – commits a
transaction
ROLLBACKTransaction – ROLLBACK a
transaction in case of any error
 COMMIT - save work done
 SAVEPOINT - identify a point in a transaction
to which you can later roll back
 ROLLBACK - restore database to original
since the last COMMIT
 SETTRANSACTION - Change transaction
options like isolation level and what rollback
segment to use
 Transaction Control Language(TCL)
commands are used to manage transactions
in database.These are used to manage the
changes made by DML statements. It also
allows statements to be grouped together
into logical transactions.
 Commit command
 Commit command is used to permanently
save any transaaction into database.
 Following is Commit command's syntax,
 commit;
 Rollback command
 This command restores the database to last
commited state. It is also use with savepoint
command to jump to a savepoint in a
transaction.
 Following is Rollback command's syntax,
 rollback to savepoint-name;
 Savepoint command
 savepoint command is used to temporarily
save a transaction so that you can rollback to
that point whenever necessary.
 Following is savepoint command's syntax,
 savepoint savepoint-name;
ID NAME
1 dar
2 wahab
4 sadiq
 INSERT into class values(5,'Rahul'); commit;
UPDATE class set name='abhijit' where id='5';
savepoint A; INSERT into class
values(6,'Chris'); savepoint B; INSERT into
class values(7,'Bravo'); savepoint C; SELECT *
from class;
ID NAME
1 dar
2 wahab
4 sadiq
5 hmftj
6 maha
7 anza
 rollback to B; SELECT * from class;
ID NAME
1 dar
2 wahab
4 sadiq
5 maha
6 anza
 rollback to A; SELECT * from class;
ID NAME
1 dar
2 wahab
4 sadiq
5 sarim
 DQL: Data Query Language OR
DRL: Data Retrieval Language
 DRL means Data Retrieval Language.This will be used
for the retrieval of the data from the database.
In order to see the data present in the database, we
will use DRL statement.We have only one DRL
statement.
 SELECT is the only DRL statement in SQL
 Select is DRL/DQL i.e. data retrieval Language
 DML (Data Manipulation Language). These SQL statements are used to retrieve and
manipulate data. This category encompasses the most fundamental commands including
DELETE, INSERT, SELECT, and UPDATE. DML SQL statements have only minor differences
between SQL variations. DML SQL commands include the following:
 DELETE to remove rows.
 INSERT to add a row.
 SELECT to retrieve row.
 UPDATE to change data in specified columns.
 DDL (Data Definition Language).These SQL statements define the structure of a database,
including rows, columns, tables, indexes, and database specifics such as file locations. DDL SQL
statements are more part of the DBMS and have large differences between the SQL variations.
DML SQL commands include the following:
 CREATE to make a new database, table, index, or stored query.
 DROP to destroy an existing database, table, index, or view.
 DBCC (Database Console Commands) statements check the physical and logical consistency of a
database.
 DCL (Data Control Language). These SQL statements control the security and permissions of
the objects or parts of the database(s). DCL SQL statements are also more part of the DBMS and
have large differences between the SQL variations. DML SQL commands include the following:
 GRANT to allow specified users to perform specified tasks.
 DENY to disallow specified users from performing specified tasks.
 REVOKE to cancel previously granted or denied permissions.
 »
 During the execution of DDL command. DDL
command would not copy the actual content
to rollback table space, hence it is fast
compared to DML command.
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples

More Related Content

What's hot (20)

PPTX
joins in database
Sultan Arshad
 
PPTX
database language ppt.pptx
Anusha sivakumar
 
PPTX
Relational model
Dabbal Singh Mahara
 
PPTX
Triggers
Pooja Dixit
 
PPT
11. Storage and File Structure in DBMS
koolkampus
 
PPTX
DATABASE CONSTRAINTS
sunanditaAnand
 
PPTX
Introduction to database & sql
zahid6
 
PPT
PL/SQL Introduction and Concepts
Bharat Kalia
 
PPT
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
PPTX
basic structure of SQL FINAL.pptx
Anusha sivakumar
 
PPTX
SQL(DDL & DML)
Sharad Dubey
 
PPTX
5. stored procedure and functions
Amrit Kaur
 
PPT
Abstract data types
Poojith Chowdhary
 
PPTX
introdution to SQL and SQL functions
farwa waqar
 
PPTX
Relational Algebra,Types of join
raj upadhyay
 
PPTX
serializability in dbms
Saranya Natarajan
 
PPT
Codd's rules
Mohd Arif
 
PPTX
Sql fundamentals
Ravinder Kamboj
 
PPTX
All data models in dbms
Naresh Kumar
 
PPTX
Transaction management DBMS
Megha Patel
 
joins in database
Sultan Arshad
 
database language ppt.pptx
Anusha sivakumar
 
Relational model
Dabbal Singh Mahara
 
Triggers
Pooja Dixit
 
11. Storage and File Structure in DBMS
koolkampus
 
DATABASE CONSTRAINTS
sunanditaAnand
 
Introduction to database & sql
zahid6
 
PL/SQL Introduction and Concepts
Bharat Kalia
 
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
basic structure of SQL FINAL.pptx
Anusha sivakumar
 
SQL(DDL & DML)
Sharad Dubey
 
5. stored procedure and functions
Amrit Kaur
 
Abstract data types
Poojith Chowdhary
 
introdution to SQL and SQL functions
farwa waqar
 
Relational Algebra,Types of join
raj upadhyay
 
serializability in dbms
Saranya Natarajan
 
Codd's rules
Mohd Arif
 
Sql fundamentals
Ravinder Kamboj
 
All data models in dbms
Naresh Kumar
 
Transaction management DBMS
Megha Patel
 

Similar to DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples (20)

PPTX
Sql queries
sabapathi shanmugam
 
PPTX
An intoduction to sql and its components
Monika Jain DAIMSR
 
PDF
ppt.pdf
BrahmamKolli
 
DOCX
Oracle 11g SQL Overview
Prathap Narayanappa
 
PPTX
database management system: sql commands lab sql
trapeziumtrapezoid12
 
PPTX
DBMS UNIT-2.pptx ggggggggggggggggggggggg
Praveen Kumar
 
PPTX
Introduction to database and sql fir beginers
reshmi30
 
PPTX
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
PPT
Mysql Ppt
Hema Prasanth
 
PDF
sql all type of commands in this power point presentation
BrahmamKolli
 
PDF
COMMANDS PPT(1).pdf
BrahmamKolli
 
PPTX
Unit - II.pptx
MrsSavitaKumbhare
 
PPTX
Structured Query Language
Surkhab Shelly
 
PPTX
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
PPT
Sql Commands_Dr.R.Shalini.ppt
DrRShaliniVISTAS
 
PDF
SQL_NOTES.pdf
AnshumanDwivedi14
 
PPTX
Database Management System PART- II.pptx
errvmaurya563
 
DOCX
ii bcom dbms SQL Commands.docx
lakshmi77
 
Sql queries
sabapathi shanmugam
 
An intoduction to sql and its components
Monika Jain DAIMSR
 
ppt.pdf
BrahmamKolli
 
Oracle 11g SQL Overview
Prathap Narayanappa
 
database management system: sql commands lab sql
trapeziumtrapezoid12
 
DBMS UNIT-2.pptx ggggggggggggggggggggggg
Praveen Kumar
 
Introduction to database and sql fir beginers
reshmi30
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
Mysql Ppt
Hema Prasanth
 
sql all type of commands in this power point presentation
BrahmamKolli
 
COMMANDS PPT(1).pdf
BrahmamKolli
 
Unit - II.pptx
MrsSavitaKumbhare
 
Structured Query Language
Surkhab Shelly
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
Sql Commands_Dr.R.Shalini.ppt
DrRShaliniVISTAS
 
SQL_NOTES.pdf
AnshumanDwivedi14
 
Database Management System PART- II.pptx
errvmaurya563
 
ii bcom dbms SQL Commands.docx
lakshmi77
 
Ad

More from LGS, GBHS&IC, University Of South-Asia, TARA-Technologies (20)

PDF
POSIMS Point Of Sale & Inventory Management System
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Waste management app launched for lahore | TARA-Technologies
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PPTX
The Way To Perform Hajj Islamic Pilgrimage
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Hajj All Duas * Pilgrimage Supplications
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PPTX
Russian Conversations and Dialogues​ -hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
DOCX
Continuous Integration vs Continuous Delivery vs Continuous Deployment
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Emotional Intelligence Info-graphic
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Human Computer Interaction Evaluation
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
Good Men Live For Others Precis Writing -hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PDF
R&D Comes to Services: Software House's Pathbreaking Experiments
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
POSIMS Point Of Sale & Inventory Management System
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Waste management app launched for lahore | TARA-Technologies
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
The Way To Perform Hajj Islamic Pilgrimage
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Hajj All Duas * Pilgrimage Supplications
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Russian Conversations and Dialogues​ -hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Continuous Integration vs Continuous Delivery vs Continuous Deployment
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Human Computer Interaction Evaluation
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Good Men Live For Others Precis Writing -hmftj
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
R&D Comes to Services: Software House's Pathbreaking Experiments
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Ad

Recently uploaded (20)

PDF
InformaticsPractices-MS - Google Docs.pdf
seshuashwin0829
 
PDF
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
PPTX
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
PPTX
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
PDF
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Tamanna36
 
PPTX
apidays Singapore 2025 - Generative AI Landscape Building a Modern Data Strat...
apidays
 
PDF
Using AI/ML for Space Biology Research
VICTOR MAESTRE RAMIREZ
 
PPTX
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
PDF
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
PDF
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
PDF
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
PDF
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PPTX
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
PPTX
04_Tamás Marton_Intuitech .pptx_AI_Barometer_2025
FinTech Belgium
 
PPTX
apidays Helsinki & North 2025 - Running a Successful API Program: Best Practi...
apidays
 
PPTX
apidays Helsinki & North 2025 - APIs at Scale: Designing for Alignment, Trust...
apidays
 
PDF
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
PDF
1750162332_Snapshot-of-Indias-oil-Gas-data-May-2025.pdf
sandeep718278
 
PDF
Data Science Course Certificate by Sigma Software University
Stepan Kalika
 
InformaticsPractices-MS - Google Docs.pdf
seshuashwin0829
 
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Tamanna36
 
apidays Singapore 2025 - Generative AI Landscape Building a Modern Data Strat...
apidays
 
Using AI/ML for Space Biology Research
VICTOR MAESTRE RAMIREZ
 
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
04_Tamás Marton_Intuitech .pptx_AI_Barometer_2025
FinTech Belgium
 
apidays Helsinki & North 2025 - Running a Successful API Program: Best Practi...
apidays
 
apidays Helsinki & North 2025 - APIs at Scale: Designing for Alignment, Trust...
apidays
 
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
1750162332_Snapshot-of-Indias-oil-Gas-data-May-2025.pdf
sandeep718278
 
Data Science Course Certificate by Sigma Software University
Stepan Kalika
 

DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples

  • 4.  SQL language is divided into four types of primary language statements: DML, DDL, DCL andTCL. Using these statements, we can define the structure of a database by creating and altering database objects, and we can manipulate data in a table through updates or deletions.We also can control which user can read/write data or manage transactions to create a single unit of work.
  • 5.  1. DML (Data Manipulation Language) 2. DDL (Data Definition Language) 3. DCL (Data Control Language) 4. TCL (Transaction Control Language)  5. DRL
  • 6.  DML statements affect records in a table.These are basic operations we perform on data such as selecting a few records from a table, inserting new records, deleting unnecessary records, and updating/modifying existing records.  DML statements include the following:  SELECT – select records from a table INSERT – insert new records UPDATE – update/Modify existing records DELETE – delete existing records
  • 7.  INSERT - insert data into a table  UPDATE - updates existing data within a table  DELETE - deletes all records from a table, the space for the records remain  MERGE - UPSERT operation (insert or update)  CALL - call a PL/SQL or Java subprogram  EXPLAIN PLAN - explain access path to data  LOCKTABLE - control concurrency
  • 8.  DDL statements are used to alter/modify a database or table structure and schema. These statements handle the design and storage of database objects.  CREATE – create a newTable, database, schema ALTER – alter existing table, column description DROP – delete existing objects from database
  • 9.  CREATE - to create objects in the database  ALTER - alters the structure of the database  DROP - delete objects from the database  TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed  COMMENT - add comments to the data dictionary  RENAME - rename an object
  • 10.  DCL statements control the level of access that users have on database objects. GRANT - gives user's access privileges to database GRANT – allows users to read/write on certain database objects REVOKE - withdraw access privileges given with the GRANT command REVOKE – keeps users from read/write permission on database objects
  • 11.  TCL statements allow you to control and manage transactions to maintain the integrity of data within SQL statements.  BEGINTransaction – opens a transaction COMMITTransaction – commits a transaction ROLLBACKTransaction – ROLLBACK a transaction in case of any error
  • 12.  COMMIT - save work done  SAVEPOINT - identify a point in a transaction to which you can later roll back  ROLLBACK - restore database to original since the last COMMIT  SETTRANSACTION - Change transaction options like isolation level and what rollback segment to use
  • 13.  Transaction Control Language(TCL) commands are used to manage transactions in database.These are used to manage the changes made by DML statements. It also allows statements to be grouped together into logical transactions.
  • 14.  Commit command  Commit command is used to permanently save any transaaction into database.  Following is Commit command's syntax,  commit;
  • 15.  Rollback command  This command restores the database to last commited state. It is also use with savepoint command to jump to a savepoint in a transaction.  Following is Rollback command's syntax,  rollback to savepoint-name;
  • 16.  Savepoint command  savepoint command is used to temporarily save a transaction so that you can rollback to that point whenever necessary.  Following is savepoint command's syntax,  savepoint savepoint-name;
  • 17. ID NAME 1 dar 2 wahab 4 sadiq
  • 18.  INSERT into class values(5,'Rahul'); commit; UPDATE class set name='abhijit' where id='5'; savepoint A; INSERT into class values(6,'Chris'); savepoint B; INSERT into class values(7,'Bravo'); savepoint C; SELECT * from class;
  • 19. ID NAME 1 dar 2 wahab 4 sadiq 5 hmftj 6 maha 7 anza
  • 20.  rollback to B; SELECT * from class;
  • 21. ID NAME 1 dar 2 wahab 4 sadiq 5 maha 6 anza
  • 22.  rollback to A; SELECT * from class;
  • 23. ID NAME 1 dar 2 wahab 4 sadiq 5 sarim
  • 24.  DQL: Data Query Language OR DRL: Data Retrieval Language  DRL means Data Retrieval Language.This will be used for the retrieval of the data from the database. In order to see the data present in the database, we will use DRL statement.We have only one DRL statement.  SELECT is the only DRL statement in SQL  Select is DRL/DQL i.e. data retrieval Language
  • 25.  DML (Data Manipulation Language). These SQL statements are used to retrieve and manipulate data. This category encompasses the most fundamental commands including DELETE, INSERT, SELECT, and UPDATE. DML SQL statements have only minor differences between SQL variations. DML SQL commands include the following:  DELETE to remove rows.  INSERT to add a row.  SELECT to retrieve row.  UPDATE to change data in specified columns.  DDL (Data Definition Language).These SQL statements define the structure of a database, including rows, columns, tables, indexes, and database specifics such as file locations. DDL SQL statements are more part of the DBMS and have large differences between the SQL variations. DML SQL commands include the following:  CREATE to make a new database, table, index, or stored query.  DROP to destroy an existing database, table, index, or view.  DBCC (Database Console Commands) statements check the physical and logical consistency of a database.  DCL (Data Control Language). These SQL statements control the security and permissions of the objects or parts of the database(s). DCL SQL statements are also more part of the DBMS and have large differences between the SQL variations. DML SQL commands include the following:  GRANT to allow specified users to perform specified tasks.  DENY to disallow specified users from performing specified tasks.  REVOKE to cancel previously granted or denied permissions.  »
  • 26.  During the execution of DDL command. DDL command would not copy the actual content to rollback table space, hence it is fast compared to DML command.