SlideShare a Scribd company logo
1 of 11
DQL commands
It consists of only 1 command i.e. SELECT command.
SELECT
it is used to retrieve all the records or particular record from table.
Syntax :
i. SELECT * from <table_name>;
This will retrieve all the records from table.
ii. SELECT * from <table_name> WHERE condition;
This will retrieve particular records from table, according to specified
condition.
Mrs. Pallavi Patil
DML commands
1. Insert command
Used to insert values into created table.
Syntax 1: for inserting single row
Insert into <table_name> values(value1, value2,…..,value n);
Ex. Insert into student values(111,’aaa’,86);
 Syntax 2 : by using attribute list
Insert into <table_name> (attribute1, attribute2,…….,attribute n) values
(value1, value2,……., value n);
Mrs. Pallavi Patil
 Syntax 3: for inserting values for particular column
Insert into <table_name>(column1, column2)values(value1, value2);
2. Update command
It is used to change data values in the table.
We can update one or more values using update command.
Syntax:
UPDATE <table_name> SET column_name=expression WHERE condition;
Ex. UPDATE student SET marks= marks+3 where class =‘TY’;
Mrs. Pallavi Patil
3. DELETE
This command is used to delete particular rows or records from the
database table.
DELETE command without WHERE clause will delete all the records from
table.
• syntax 1:
DELETE from <table_name> WHERE condition;
This syntax is used to delete particular record.
• Syntax 2:
DELETE from <Table_name>;
This syntax will delete all the records from table.
Mrs. Pallavi Patil
DCL commands
• Used to control various user actions like insert, update, delete or viewing
data.
• DCL commands also perform task of assigning privileges. So user can
access certain objects in database.
Mrs. Pallavi Patil
 Create user
• The database administrator can create users of database by using this
command.
Syntax:
Create user <username> identified by <password>;
Ex.
Create user admin1 identified by ad123;
GRANT
• Grant command allows user to do certain operations on other user’s table.
• The different types of previleges can be granted to users such as alter,
insert, delete, update, select, etc.
Mrs. Pallavi Patil
Syntax:
Grant <privilege list> on <TableName> to <username>;
Ex.
Grant insert , update on student_info to admin1;
REVOKE
• It is used to cancel or to take back the granted privileges from the
specific user.
Syntax
Revoke <privileges list> on table_name from <user_name>;
Ex. Revoke insert on student_info from admin1;
Mrs. Pallavi Patil
TCL Commands
COMMIT command
• It is used to make changes permanent in the database. This command is
used to end the transaction.
Syntax:
COMMIT;
Mrs. Pallavi Patil
Savepoint
• Savepoints are treated as marker to divide very lengthy transactions into
smaller one.
• We can create marker within current transaction using savepoint
statement.
• All savepoints get erased when commit command is used.
• You can rollback the transactions after certain savepoint without rolling
back entire transaction.
Syntax:
Savepoint savepoint_name;
Mrs. Pallavi Patil
Savepoint sp1;
DELETE from student where rollno=3;
Savepoint sp2;
Update student set student_name=‘ABC’ where rollno=1;
Delete from student where rollno=5;
Savepoint sp3;
Delete from student where rollno=8;
Mrs. Pallavi Patil
3. Rollback
• Rollback is used to undo or cancel the changes done in current
transactions.
• We rollback entire transactions using rollback command or if savepoint
is given, rollback can be done till specific savepoint.
Syntax:
Rollback;
Or
Rollback to savepoint_name;
Mrs. Pallavi Patil

More Related Content

Similar to DML, DCL and TCL commands in SQL database.pptx

ii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docxii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docx
lakshmi77
 

Similar to DML, DCL and TCL commands in SQL database.pptx (20)

COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
Structured Query Language(SQL)
Structured Query Language(SQL)Structured Query Language(SQL)
Structured Query Language(SQL)
 
SQL
SQLSQL
SQL
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 
ii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docxii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docx
 
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
 
SQL
SQLSQL
SQL
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
Les08
Les08Les08
Les08
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)
 
Ddl &amp; dml commands
Ddl &amp; dml commandsDdl &amp; dml commands
Ddl &amp; dml commands
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
IR SQLite Session #3
IR SQLite Session #3IR SQLite Session #3
IR SQLite Session #3
 
Its about a sql topic for basic structured query language
Its about a sql topic for basic structured query languageIts about a sql topic for basic structured query language
Its about a sql topic for basic structured query language
 
Lecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML TriggersLecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML Triggers
 
Mysql
MysqlMysql
Mysql
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 

Recently uploaded

Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
MaherOthman7
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
drjose256
 

Recently uploaded (20)

The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
Artificial Intelligence in due diligence
Artificial Intelligence in due diligenceArtificial Intelligence in due diligence
Artificial Intelligence in due diligence
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Autodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptxAutodesk Construction Cloud (Autodesk Build).pptx
Autodesk Construction Cloud (Autodesk Build).pptx
 
15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon15-Minute City: A Completely New Horizon
15-Minute City: A Completely New Horizon
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
analog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptxanalog-vs-digital-communication (concept of analog and digital).pptx
analog-vs-digital-communication (concept of analog and digital).pptx
 
Software Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfSoftware Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdf
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference Modal
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Independent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging StationIndependent Solar-Powered Electric Vehicle Charging Station
Independent Solar-Powered Electric Vehicle Charging Station
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 

DML, DCL and TCL commands in SQL database.pptx

  • 1. DQL commands It consists of only 1 command i.e. SELECT command. SELECT it is used to retrieve all the records or particular record from table. Syntax : i. SELECT * from <table_name>; This will retrieve all the records from table. ii. SELECT * from <table_name> WHERE condition; This will retrieve particular records from table, according to specified condition. Mrs. Pallavi Patil
  • 2. DML commands 1. Insert command Used to insert values into created table. Syntax 1: for inserting single row Insert into <table_name> values(value1, value2,…..,value n); Ex. Insert into student values(111,’aaa’,86);  Syntax 2 : by using attribute list Insert into <table_name> (attribute1, attribute2,…….,attribute n) values (value1, value2,……., value n); Mrs. Pallavi Patil
  • 3.  Syntax 3: for inserting values for particular column Insert into <table_name>(column1, column2)values(value1, value2); 2. Update command It is used to change data values in the table. We can update one or more values using update command. Syntax: UPDATE <table_name> SET column_name=expression WHERE condition; Ex. UPDATE student SET marks= marks+3 where class =‘TY’; Mrs. Pallavi Patil
  • 4. 3. DELETE This command is used to delete particular rows or records from the database table. DELETE command without WHERE clause will delete all the records from table. • syntax 1: DELETE from <table_name> WHERE condition; This syntax is used to delete particular record. • Syntax 2: DELETE from <Table_name>; This syntax will delete all the records from table. Mrs. Pallavi Patil
  • 5. DCL commands • Used to control various user actions like insert, update, delete or viewing data. • DCL commands also perform task of assigning privileges. So user can access certain objects in database. Mrs. Pallavi Patil
  • 6.  Create user • The database administrator can create users of database by using this command. Syntax: Create user <username> identified by <password>; Ex. Create user admin1 identified by ad123; GRANT • Grant command allows user to do certain operations on other user’s table. • The different types of previleges can be granted to users such as alter, insert, delete, update, select, etc. Mrs. Pallavi Patil
  • 7. Syntax: Grant <privilege list> on <TableName> to <username>; Ex. Grant insert , update on student_info to admin1; REVOKE • It is used to cancel or to take back the granted privileges from the specific user. Syntax Revoke <privileges list> on table_name from <user_name>; Ex. Revoke insert on student_info from admin1; Mrs. Pallavi Patil
  • 8. TCL Commands COMMIT command • It is used to make changes permanent in the database. This command is used to end the transaction. Syntax: COMMIT; Mrs. Pallavi Patil
  • 9. Savepoint • Savepoints are treated as marker to divide very lengthy transactions into smaller one. • We can create marker within current transaction using savepoint statement. • All savepoints get erased when commit command is used. • You can rollback the transactions after certain savepoint without rolling back entire transaction. Syntax: Savepoint savepoint_name; Mrs. Pallavi Patil
  • 10. Savepoint sp1; DELETE from student where rollno=3; Savepoint sp2; Update student set student_name=‘ABC’ where rollno=1; Delete from student where rollno=5; Savepoint sp3; Delete from student where rollno=8; Mrs. Pallavi Patil
  • 11. 3. Rollback • Rollback is used to undo or cancel the changes done in current transactions. • We rollback entire transactions using rollback command or if savepoint is given, rollback can be done till specific savepoint. Syntax: Rollback; Or Rollback to savepoint_name; Mrs. Pallavi Patil