SlideShare a Scribd company logo
3
Most read
5
Most read
9
Most read
DML & DCL command
Submitted by –
Pragya Singh
Class – BSc I.T. 4th semester
Content -
SQL
Introduction of DML and DCL
Statement of DML and DCL
Multiple type question
Structure Query Language(SQL)
Structure Query Language(SQL) is a database query
language used for storing and managing data in Relational
DBMS. SQL was the first commercial language
introduced for E.F Codd's Relational model of database.
Types of SQL statements –
1. DML (data manipulation language)
2. DDL (data definition language)
3. DCL (data control language)
4.TCL (transaction control language)
Introduction of DML
DML is short name of Data Manipulation Language which
deals with data manipulation and includes most common
SQL statements such SELECT, INSERT, UPDATE,
DELETE, etc., and it is used to store, modify, retrieve,
delete and update data in a database.
SELECT - retrieve data from a database
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - Delete all records from a database table
Select command is used to view the records from the table.
To view all the columns and all the rows ‘*’can be specified
with the select statement. The name of the table is required
while specifying the select.
Syntax :-
 Select * from <tablename>;
E.G.
“Sql> select * from student;”
Output:-
Select Command:-
ROLLNO NAME MARKS ADDR
101 ABC 75 LINK ROAD
102 XYZ 80 JM ROAD
103 PQR 67 N7
Cont…
Select statement is very flexible. If user needs to view
only certain fields or columns, then by specifying those
names of the columns in the form of list, user can view the
required output.
 The general form is as follows:
Select column1, column2, column3…… column n from <tablename>;
e.g., SQL> select rollno, name, marks from student;
Output:-
ROLLNO NAME MARKS
101 ABC 75
102 XYZ 80
103 PQR 67
3 rows selected.
Cont…
To select particular row ‘where clause is used. This clause
allows user to put the condition. The rows or columns which
satisfy the condition will be displayed.
 Syntax:-
Select<column1><column2><column3> from <tablename> where condition;
e.g., SQL> select * from student where marks=80;
ROLLNO NAME MARKS ADDR
102 XYZ 80 JM ROAD
Insert Command:-
After creating table successfully, records can be entered.
The insert command is used to put the records into the
table.
Syntax :-
Insert into <table name> values (value1, value2, value3…);
The list of values means the values given one by one for
each of the attribute or may not be for some of the
attributes. The values which are number can written as it
is but values which are characters and date types are
specified in ‘ ‘ i.e. In single quotation marks.
E.g., Insert into student values(101,’abc’,75,’Link road’);
Cont…
The above statement allows user to enter one by one record by
putting the values along with insert command. To enter
multiple values continuously one by one we can specify the
general command which can be afterwards run by giving the ‘ /
‘.
e.g., SQL> insert into student values(&rollno,’&studname’,&marks,’&addr’);
 After giving this command the following output will come:
 Enter value for rollno:101
 Enter value for name:xyz
 Enter value for marks: 80
 Enter value for addr: JM road
Cont…
 Old 1: insert into student values(&rollno,’&studname’,&marks,’&addr’);
 New 1: insert into student values(102,’xyz’,80,’JM road’);
1 row created
Roll no Studname marks addr
102 xyz 80 JM road
Update Command:-
 The tables can be updated using the set clause. Either all rows will be updated or modified or
selected rows can be updated using the where clause. The set clause is used to define the
modifications of a particular column.
 The syntax of update command is:
 Update<table name>set <columnname>=<expression>,<columnname>=<expression >;
 SQL> update student set marks= 85;
 3 rows updated.
 SQL> select * from student;
 Output:-
ROLLNO NAME MARKS ADDR
101 ABC 85 LINK ROAD
102 XYZ 85 JM ROAD
103 PQR 85 N7
Cont…
 Update Command – specifies the rows to be changed using where clause and new fata using set
keyword.
 Ex-
 Update student set sname =‘PQR’ where Roll NO = 101;
ROLLNO NAME MARKS ADDR
101 PQR 85 LINK ROAD
102 XYZ 85 JM ROAD
103 PQR 85 N7
Delete Command:-
 The delete operation can be performed on the table to remove or delete the particular records or
even all records.
 Syntax:-
 Delete from student where addr =N7;
 1 row deleted
 SQL> select * from student;
ROLLNO NAME MARKS ADDR
101 ABC 75 LINK ROAD
102 XYZ 80 JM ROAD
Output
Cont…
 To delete all records from the table the following command is used.
 SQL> delete from student;
 3 rows deleted.
Introduction to DCL
DCL stands for Data Control Language.
DCL is used to control user access in a database.
This command is related to the security issues.
Using DCL command, it allows or restricts the user from
accessing data in database schema.
DCL commands are as follows,
1. GRANT
2. REVOKE
It is used to grant or revoke access permissions from any
database user.
Grant command
GRANT command gives user's access privileges to the
database.
This command allows specified users to perform specific
tasks.
 Syntax:
GRANT <privilege list>
ON <relation name or view name>
TO <user/role list>;
Example : GRANT Command
 GRANT ALL ON employee
TO ABC;
[WITH GRANT OPTION]
 In the above example, user 'ABC' has been given permission to view and modify the records in the
'employee' table.
Revoke command
REVOKE command is used to cancel previously granted or
denied permissions.
This command withdraw access privileges given with the
GRANT command.
It takes back permissions from user.
 Syntax:
REVOKE <privilege list>
ON <relation name or view name>
FROM <user name>;
Example : REVOKE Command
 REVOKE UPDATE
ON employee
FROM ABC;
MCQ
1.The language used application programs to request data from the DBMS is referred to as __________
a) DML
b) DDL
c) Query language
d) All of the Mentioned
 Answer:a
Explanation: Data Manipulation Language (DML) statements are used for managing data in
database. DML commands are not auto-committed. It means changes made by DML command are
not permanent to database, it can be rolled back.
2. Which of the following keyword is used with Data Control Language (DCL) statements?
a) SELECT
b) INSERT
c) DELETE
d) GRANT
 Answer:d
Explanation: GRANT is the keyword which is used with Data Control Language statements
Cont…
3.Which of the following keyword is used with Data Control Language (DCL) statements?
a) SELECT
b) INSERT
c) DELETE
d) GRANT
 Answer:d
Explanation: GRANT is the keyword which is used with Data Control Language statements.
4. Which of the following is not included in DML (Data Manipulation Language)
a) INSERT
b) UPDATE
c) DELETE
d) CREATE
 Answer:d
Explanation: The CREATE TABLE statement is used to create a table in a database. Tables are
organized into rows and columns; and each table must have a name.
References
 Fundamental of Database System
Elmasri . Navathe
 Database System Concept
Henry F.koth
https://www.geeksforgeeks.org/sql-ddl-dml-dcl-tcl-commands/ on 28th March 2019
https://www.w3schools.in/mysql/ddl-dml-dcl/ on 28th March 2019
SQL commands

More Related Content

What's hot (20)

PPTX
DDL And DML
pnp @in
 
PPT
Constraints In Sql
Anurag
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
SQL - DML and DDL Commands
Shrija Madhu
 
PPTX
Applications of DBMS(Database Management System)
chhinder kaur
 
PPTX
Sql queries presentation
NITISH KUMAR
 
PPTX
Sql commands
Pooja Dixit
 
PPTX
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
PPTX
database language ppt.pptx
Anusha sivakumar
 
PPTX
Functional dependency
Tamajit Chakraborty
 
PPTX
set operators.pptx
Anusha sivakumar
 
PPT
Sql ppt
Anuja Lad
 
PPT
Joins in SQL
Vigneshwaran Sankaran
 
PPT
Entity Relationship Diagram
Shakila Mahjabin
 
PPTX
Introduction to database & sql
zahid6
 
ODP
Sql commands
Balakumaran Arunachalam
 
PPTX
sql function(ppt)
Ankit Dubey
 
PPTX
The database applications
Dolat Ram
 
PPT
Basic DBMS ppt
dangwalrajendra888
 
DDL And DML
pnp @in
 
Constraints In Sql
Anurag
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
SQL - DML and DDL Commands
Shrija Madhu
 
Applications of DBMS(Database Management System)
chhinder kaur
 
Sql queries presentation
NITISH KUMAR
 
Sql commands
Pooja Dixit
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
database language ppt.pptx
Anusha sivakumar
 
Functional dependency
Tamajit Chakraborty
 
set operators.pptx
Anusha sivakumar
 
Sql ppt
Anuja Lad
 
Joins in SQL
Vigneshwaran Sankaran
 
Entity Relationship Diagram
Shakila Mahjabin
 
Introduction to database & sql
zahid6
 
sql function(ppt)
Ankit Dubey
 
The database applications
Dolat Ram
 
Basic DBMS ppt
dangwalrajendra888
 

Similar to SQL commands (20)

PPT
Sql Commands_Dr.R.Shalini.ppt
DrRShaliniVISTAS
 
DOC
Oracle sql material
prathap kumar
 
PDF
CS3481_Database Management Laboratory .pdf
Kirubaburi R
 
PPTX
SQL commands in database managemant systems
pmselvaraj
 
PDF
Sql smart reference_by_prasad
paddu123
 
PDF
Sql smart reference_by_prasad
paddu123
 
PPTX
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
PPTX
Introduction to sql new
SANTOSH RATH
 
PPTX
Lab
neelam_rawat
 
PPTX
SQL Query
Imam340267
 
PPT
Lab_04.ppt opreating system of computer lab
MUHAMMADANSAR76
 
PPTX
SQl data base management and design
franckelsania20
 
PPTX
GFGC CHIKKABASUR ( DML COMMANDS )
GOVT FIRST GRADE COLLEGE CHIKKABASUR
 
PPTX
Introduction to SQl Commands.pptxhhjhvvb
DeepakSingh99214
 
PDF
Data Definition Language Commands - Examples
Deena38
 
PDF
225523359001djcj4_DBMS_LAB_THEORY_DML.pdf
sahilurrahemankhan
 
PPTX
sql.pptx
harshsolankurephotos
 
PPTX
SQL commands powerpoint presentation. Ppt
umadevikakarlapudi
 
PPT
SQL. It education ppt for reference sql process coding
aditipandey498628
 
DOCX
unit-5 sql notes.docx
RaviRajput416403
 
Sql Commands_Dr.R.Shalini.ppt
DrRShaliniVISTAS
 
Oracle sql material
prathap kumar
 
CS3481_Database Management Laboratory .pdf
Kirubaburi R
 
SQL commands in database managemant systems
pmselvaraj
 
Sql smart reference_by_prasad
paddu123
 
Sql smart reference_by_prasad
paddu123
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
Introduction to sql new
SANTOSH RATH
 
SQL Query
Imam340267
 
Lab_04.ppt opreating system of computer lab
MUHAMMADANSAR76
 
SQl data base management and design
franckelsania20
 
GFGC CHIKKABASUR ( DML COMMANDS )
GOVT FIRST GRADE COLLEGE CHIKKABASUR
 
Introduction to SQl Commands.pptxhhjhvvb
DeepakSingh99214
 
Data Definition Language Commands - Examples
Deena38
 
225523359001djcj4_DBMS_LAB_THEORY_DML.pdf
sahilurrahemankhan
 
SQL commands powerpoint presentation. Ppt
umadevikakarlapudi
 
SQL. It education ppt for reference sql process coding
aditipandey498628
 
unit-5 sql notes.docx
RaviRajput416403
 
Ad

More from GirdharRatne (7)

PPTX
Relational algebra ppt
GirdharRatne
 
PPTX
DBMS Integrity rule
GirdharRatne
 
PPTX
System analysis and design logical design
GirdharRatne
 
PPTX
Transmisssion media
GirdharRatne
 
PPTX
Mobile telephone system
GirdharRatne
 
PPTX
Introduction to journal entry
GirdharRatne
 
PPTX
Programming language and process
GirdharRatne
 
Relational algebra ppt
GirdharRatne
 
DBMS Integrity rule
GirdharRatne
 
System analysis and design logical design
GirdharRatne
 
Transmisssion media
GirdharRatne
 
Mobile telephone system
GirdharRatne
 
Introduction to journal entry
GirdharRatne
 
Programming language and process
GirdharRatne
 
Ad

Recently uploaded (20)

PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
PDF
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
PDF
SAP GUI Installation Guide for macOS (iOS) | Connect to SAP Systems on Mac
SAP Vista, an A L T Z E N Company
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
PDF
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PDF
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
PDF
AI Image Enhancer: Revolutionizing Visual Quality”
docmasoom
 
PPT
Brief History of Python by Learning Python in three hours
adanechb21
 
PDF
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
PDF
Infrastructure planning and resilience - Keith Hastings.pptx.pdf
Safe Software
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
On Software Engineers' Productivity - Beyond Misleading Metrics
Romén Rodríguez-Gil
 
SAP GUI Installation Guide for macOS (iOS) | Connect to SAP Systems on Mac
SAP Vista, an A L T Z E N Company
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
Activate_Methodology_Summary presentatio
annapureddyn
 
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
AI Image Enhancer: Revolutionizing Visual Quality”
docmasoom
 
Brief History of Python by Learning Python in three hours
adanechb21
 
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
Infrastructure planning and resilience - Keith Hastings.pptx.pdf
Safe Software
 

SQL commands

  • 1. DML & DCL command Submitted by – Pragya Singh Class – BSc I.T. 4th semester
  • 2. Content - SQL Introduction of DML and DCL Statement of DML and DCL Multiple type question
  • 3. Structure Query Language(SQL) Structure Query Language(SQL) is a database query language used for storing and managing data in Relational DBMS. SQL was the first commercial language introduced for E.F Codd's Relational model of database. Types of SQL statements – 1. DML (data manipulation language) 2. DDL (data definition language) 3. DCL (data control language) 4.TCL (transaction control language)
  • 4. Introduction of DML DML is short name of Data Manipulation Language which deals with data manipulation and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE, etc., and it is used to store, modify, retrieve, delete and update data in a database. SELECT - retrieve data from a database INSERT - insert data into a table UPDATE - updates existing data within a table DELETE - Delete all records from a database table
  • 5. Select command is used to view the records from the table. To view all the columns and all the rows ‘*’can be specified with the select statement. The name of the table is required while specifying the select. Syntax :-  Select * from <tablename>; E.G. “Sql> select * from student;” Output:- Select Command:- ROLLNO NAME MARKS ADDR 101 ABC 75 LINK ROAD 102 XYZ 80 JM ROAD 103 PQR 67 N7
  • 6. Cont… Select statement is very flexible. If user needs to view only certain fields or columns, then by specifying those names of the columns in the form of list, user can view the required output.  The general form is as follows: Select column1, column2, column3…… column n from <tablename>; e.g., SQL> select rollno, name, marks from student; Output:- ROLLNO NAME MARKS 101 ABC 75 102 XYZ 80 103 PQR 67 3 rows selected.
  • 7. Cont… To select particular row ‘where clause is used. This clause allows user to put the condition. The rows or columns which satisfy the condition will be displayed.  Syntax:- Select<column1><column2><column3> from <tablename> where condition; e.g., SQL> select * from student where marks=80; ROLLNO NAME MARKS ADDR 102 XYZ 80 JM ROAD
  • 8. Insert Command:- After creating table successfully, records can be entered. The insert command is used to put the records into the table. Syntax :- Insert into <table name> values (value1, value2, value3…); The list of values means the values given one by one for each of the attribute or may not be for some of the attributes. The values which are number can written as it is but values which are characters and date types are specified in ‘ ‘ i.e. In single quotation marks. E.g., Insert into student values(101,’abc’,75,’Link road’);
  • 9. Cont… The above statement allows user to enter one by one record by putting the values along with insert command. To enter multiple values continuously one by one we can specify the general command which can be afterwards run by giving the ‘ / ‘. e.g., SQL> insert into student values(&rollno,’&studname’,&marks,’&addr’);  After giving this command the following output will come:  Enter value for rollno:101  Enter value for name:xyz  Enter value for marks: 80  Enter value for addr: JM road
  • 10. Cont…  Old 1: insert into student values(&rollno,’&studname’,&marks,’&addr’);  New 1: insert into student values(102,’xyz’,80,’JM road’); 1 row created Roll no Studname marks addr 102 xyz 80 JM road
  • 11. Update Command:-  The tables can be updated using the set clause. Either all rows will be updated or modified or selected rows can be updated using the where clause. The set clause is used to define the modifications of a particular column.  The syntax of update command is:  Update<table name>set <columnname>=<expression>,<columnname>=<expression >;  SQL> update student set marks= 85;  3 rows updated.  SQL> select * from student;  Output:- ROLLNO NAME MARKS ADDR 101 ABC 85 LINK ROAD 102 XYZ 85 JM ROAD 103 PQR 85 N7
  • 12. Cont…  Update Command – specifies the rows to be changed using where clause and new fata using set keyword.  Ex-  Update student set sname =‘PQR’ where Roll NO = 101; ROLLNO NAME MARKS ADDR 101 PQR 85 LINK ROAD 102 XYZ 85 JM ROAD 103 PQR 85 N7
  • 13. Delete Command:-  The delete operation can be performed on the table to remove or delete the particular records or even all records.  Syntax:-  Delete from student where addr =N7;  1 row deleted  SQL> select * from student; ROLLNO NAME MARKS ADDR 101 ABC 75 LINK ROAD 102 XYZ 80 JM ROAD Output
  • 14. Cont…  To delete all records from the table the following command is used.  SQL> delete from student;  3 rows deleted.
  • 15. Introduction to DCL DCL stands for Data Control Language. DCL is used to control user access in a database. This command is related to the security issues. Using DCL command, it allows or restricts the user from accessing data in database schema. DCL commands are as follows, 1. GRANT 2. REVOKE It is used to grant or revoke access permissions from any database user.
  • 16. Grant command GRANT command gives user's access privileges to the database. This command allows specified users to perform specific tasks.  Syntax: GRANT <privilege list> ON <relation name or view name> TO <user/role list>; Example : GRANT Command  GRANT ALL ON employee TO ABC; [WITH GRANT OPTION]  In the above example, user 'ABC' has been given permission to view and modify the records in the 'employee' table.
  • 17. Revoke command REVOKE command is used to cancel previously granted or denied permissions. This command withdraw access privileges given with the GRANT command. It takes back permissions from user.  Syntax: REVOKE <privilege list> ON <relation name or view name> FROM <user name>; Example : REVOKE Command  REVOKE UPDATE ON employee FROM ABC;
  • 18. MCQ 1.The language used application programs to request data from the DBMS is referred to as __________ a) DML b) DDL c) Query language d) All of the Mentioned  Answer:a Explanation: Data Manipulation Language (DML) statements are used for managing data in database. DML commands are not auto-committed. It means changes made by DML command are not permanent to database, it can be rolled back. 2. Which of the following keyword is used with Data Control Language (DCL) statements? a) SELECT b) INSERT c) DELETE d) GRANT  Answer:d Explanation: GRANT is the keyword which is used with Data Control Language statements
  • 19. Cont… 3.Which of the following keyword is used with Data Control Language (DCL) statements? a) SELECT b) INSERT c) DELETE d) GRANT  Answer:d Explanation: GRANT is the keyword which is used with Data Control Language statements. 4. Which of the following is not included in DML (Data Manipulation Language) a) INSERT b) UPDATE c) DELETE d) CREATE  Answer:d Explanation: The CREATE TABLE statement is used to create a table in a database. Tables are organized into rows and columns; and each table must have a name.
  • 20. References  Fundamental of Database System Elmasri . Navathe  Database System Concept Henry F.koth https://www.geeksforgeeks.org/sql-ddl-dml-dcl-tcl-commands/ on 28th March 2019 https://www.w3schools.in/mysql/ddl-dml-dcl/ on 28th March 2019