SlideShare a Scribd company logo
1 of 26
◾SQL language is divided into four types of
primary language statements:
DML, DDL, DCL and TCL. 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 (DataControl Language)
4. TCL (TransactionControl 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 theGRANT 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 withinSQL 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 lastCOMMIT
◾SETTRANSACTION -Change transaction
options like isolation level and what rollback
segment to use
◾TransactionControl 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 isCommit 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 toA;SELECT * from class;
ID NAME
1 dar
2 wahab
4 sadiq
5 sarim
◾ DQL: DataQuery LanguageOR
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 inSQL
◾ 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, andUPDATE. 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 (DatabaseConsoleCommands) 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 theSQL 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.
Sql queries

More Related Content

What's hot

WSDL-Design-and-Generation-in-EASparx
WSDL-Design-and-Generation-in-EASparxWSDL-Design-and-Generation-in-EASparx
WSDL-Design-and-Generation-in-EASparx
Frank Ning
 

What's hot (7)

SQL Training Institute in Ambala ! Batra Computer Centre
SQL Training Institute in Ambala ! Batra Computer CentreSQL Training Institute in Ambala ! Batra Computer Centre
SQL Training Institute in Ambala ! Batra Computer Centre
 
Nosql
NosqlNosql
Nosql
 
Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...
 
Kp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan userKp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan user
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Database concepts
Database conceptsDatabase concepts
Database concepts
 
WSDL-Design-and-Generation-in-EASparx
WSDL-Design-and-Generation-in-EASparxWSDL-Design-and-Generation-in-EASparx
WSDL-Design-and-Generation-in-EASparx
 

Similar to Sql queries

My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 

Similar to Sql queries (20)

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
 
An intoduction to sql and its components
An intoduction to sql and its componentsAn intoduction to sql and its components
An intoduction to sql and its components
 
lovely
lovelylovely
lovely
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
Database Management System (DBMS).pptx
Database Management System (DBMS).pptxDatabase Management System (DBMS).pptx
Database Management System (DBMS).pptx
 
Based on functionalities performed five types of SQL Commands
Based on functionalities performed five types of SQL CommandsBased on functionalities performed five types of SQL Commands
Based on functionalities performed five types of SQL Commands
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
Sql commands
Sql commandsSql commands
Sql commands
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
Ddl vs dml
Ddl vs dmlDdl vs dml
Ddl vs dml
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
Mysql
MysqlMysql
Mysql
 
Himani uppal-221302130 WP ppt.pptx
Himani uppal-221302130  WP ppt.pptxHimani uppal-221302130  WP ppt.pptx
Himani uppal-221302130 WP ppt.pptx
 
6.Database Languages lab-1.pptx
6.Database Languages lab-1.pptx6.Database Languages lab-1.pptx
6.Database Languages lab-1.pptx
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
Group Members
Group MembersGroup Members
Group Members
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
Introduction to SQL.pptx
Introduction to SQL.pptxIntroduction to SQL.pptx
Introduction to SQL.pptx
 
Basics of dml queries
Basics of dml queriesBasics of dml queries
Basics of dml queries
 

Recently uploaded

會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
MinawBelay
 

Recently uploaded (20)

Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 

Sql queries

  • 1.
  • 2.
  • 3. ◾SQL language is divided into four types of primary language statements: DML, DDL, DCL and TCL. 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.
  • 4. ◾1. DML (Data Manipulation Language) 2. DDL (Data Definition Language) 3.DCL (DataControl Language) 4. TCL (TransactionControl Language) ◾5. DRL
  • 5. ◾ 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
  • 6. ◾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
  • 7. ◾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
  • 8. ◾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
  • 9. ◾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 theGRANT command REVOKE – keeps users from read/write permission on database objects
  • 10. ◾TCL statements allow you to control and manage transactions to maintain the integrity of data withinSQL statements. ◾BEGINTransaction – opens a transaction COMMITTransaction – commits a transaction ROLLBACKTransaction – ROLLBACK a transaction in case of any error
  • 11. ◾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 lastCOMMIT ◾SETTRANSACTION -Change transaction options like isolation level and what rollback segment to use
  • 12. ◾TransactionControl 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.
  • 13. ◾Commit command ◾Commit command is used to permanently save any transaaction into database. ◾Following isCommit command's syntax, ◾commit;
  • 14. ◾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;
  • 15. ◾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;
  • 16. ID NAME 1 dar 2 wahab 4 sadiq
  • 17. ◾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;
  • 18. ID NAME 1 dar 2 wahab 4 sadiq 5 hmftj 6 maha 7 anza
  • 19. ◾rollback to B;SELECT * from class;
  • 20. ID NAME 1 dar 2 wahab 4 sadiq 5 maha 6 anza
  • 22. ID NAME 1 dar 2 wahab 4 sadiq 5 sarim
  • 23. ◾ DQL: DataQuery LanguageOR 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 inSQL ◾ Select is DRL/DQL i.e. data retrieval Language
  • 24. ◾ 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, andUPDATE. 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 (DatabaseConsoleCommands) 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 theSQL 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. ◾ »
  • 25. ◾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.