SlideShare a Scribd company logo
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

SQL Basics
SQL BasicsSQL Basics
SQL Basics
Hammad Rasheed
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
Bharat Kalia
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
Ehsan Hamzei
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
Stewart Rogers
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
DML Commands
DML CommandsDML Commands
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functionsVikas Gupta
 

What's hot (20)

SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Trigger
TriggerTrigger
Trigger
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Mysql
MysqlMysql
Mysql
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Sql operators & functions 3
Sql operators & functions 3Sql operators & functions 3
Sql operators & functions 3
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Sql commands
Sql commandsSql commands
Sql commands
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
trigger dbms
trigger dbmstrigger dbms
trigger dbms
 
Sql select
Sql select Sql select
Sql select
 
DML Commands
DML CommandsDML Commands
DML Commands
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 

Similar to SQL commands

Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
DrRShaliniVISTAS
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
paddu123
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
paddu123
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql newSANTOSH RATH
 
Lab
LabLab
SQL Query
SQL QuerySQL Query
SQL Query
Imam340267
 
Lab_04.ppt opreating system of computer lab
Lab_04.ppt opreating system of computer labLab_04.ppt opreating system of computer lab
Lab_04.ppt opreating system of computer lab
MUHAMMADANSAR76
 
GFGC CHIKKABASUR ( DML COMMANDS )
GFGC CHIKKABASUR ( DML COMMANDS )GFGC CHIKKABASUR ( DML COMMANDS )
GFGC CHIKKABASUR ( DML COMMANDS )
GOVT FIRST GRADE COLLEGE CHIKKABASUR
 
sql.pptx
sql.pptxsql.pptx
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
RaviRajput416403
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
EliasPetros
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SabrinaShanta2
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SaiMiryala1
 
ii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docxii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docx
lakshmi77
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
BrahmamKolli
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
BhupendraShahi6
 
Assignment#02
Assignment#02Assignment#02
Assignment#02
Sunita Milind Dol
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
Mohd Tousif
 

Similar to SQL commands (20)

Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
Oracle sql material
Oracle sql materialOracle sql material
Oracle sql material
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Lab
LabLab
Lab
 
SQL Query
SQL QuerySQL Query
SQL Query
 
Lab_04.ppt opreating system of computer lab
Lab_04.ppt opreating system of computer labLab_04.ppt opreating system of computer lab
Lab_04.ppt opreating system of computer lab
 
GFGC CHIKKABASUR ( DML COMMANDS )
GFGC CHIKKABASUR ( DML COMMANDS )GFGC CHIKKABASUR ( DML COMMANDS )
GFGC CHIKKABASUR ( DML COMMANDS )
 
sql.pptx
sql.pptxsql.pptx
sql.pptx
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
 
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
 
ii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docxii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docx
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
 
Assignment#02
Assignment#02Assignment#02
Assignment#02
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 

More from GirdharRatne

Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
GirdharRatne
 
DBMS Integrity rule
DBMS Integrity ruleDBMS Integrity rule
DBMS Integrity rule
GirdharRatne
 
System analysis and design logical design
System analysis and design  logical designSystem analysis and design  logical design
System analysis and design logical design
GirdharRatne
 
Transmisssion media
Transmisssion mediaTransmisssion media
Transmisssion media
GirdharRatne
 
Mobile telephone system
Mobile telephone systemMobile telephone system
Mobile telephone system
GirdharRatne
 
Introduction to journal entry
Introduction to journal entryIntroduction to journal entry
Introduction to journal entry
GirdharRatne
 
Programming language and process
Programming language and processProgramming language and process
Programming language and process
GirdharRatne
 

More from GirdharRatne (7)

Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
DBMS Integrity rule
DBMS Integrity ruleDBMS Integrity rule
DBMS Integrity rule
 
System analysis and design logical design
System analysis and design  logical designSystem analysis and design  logical design
System analysis and design logical design
 
Transmisssion media
Transmisssion mediaTransmisssion media
Transmisssion media
 
Mobile telephone system
Mobile telephone systemMobile telephone system
Mobile telephone system
 
Introduction to journal entry
Introduction to journal entryIntroduction to journal entry
Introduction to journal entry
 
Programming language and process
Programming language and processProgramming language and process
Programming language and process
 

Recently uploaded

Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 

Recently uploaded (20)

Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 

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