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

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
jatin batra
 
Nosql
NosqlNosql
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...
csandit
 
Kp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan userKp.3 pengaturan sistem dan user
Kp.3 pengaturan sistem dan user
Desty Yani
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
Amin Choroomi
 
Database concepts
Database conceptsDatabase concepts
Database concepts
ACCESS Health Digital
 
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

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
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
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
Monika Jain DAIMSR
 
database management system: sql commands lab sql
database management system: sql commands lab sqldatabase management system: sql commands lab sql
database management system: sql commands lab sql
trapeziumtrapezoid12
 
lovely
lovelylovely
lovely
love0323
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
pnp @in
 
Database Management System (DBMS).pptx
Database Management System (DBMS).pptxDatabase Management System (DBMS).pptx
Database Management System (DBMS).pptx
GevitaChinnaiah
 
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
sameer gaikwad
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
AnshumanDwivedi14
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
RareDeath
 
Sql commands
Sql commandsSql commands
Sql commands
Vivek Singh
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 
Ddl vs dml
Ddl vs dmlDdl vs dml
Ddl vs dml
shahbazalishahbaz
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
Prathap Narayanappa
 
Mysql
MysqlMysql
Mysql
TSUBHASHRI
 
Himani uppal-221302130 WP ppt.pptx
Himani uppal-221302130  WP ppt.pptxHimani uppal-221302130  WP ppt.pptx
Himani uppal-221302130 WP ppt.pptx
MohitYadav889220
 
6.Database Languages lab-1.pptx
6.Database Languages lab-1.pptx6.Database Languages lab-1.pptx
6.Database Languages lab-1.pptx
AshokRachapalli1
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
Sheethal Aji Mani
 
Group Members
Group MembersGroup Members
Group Members
Farhan Shahani
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
Surkhab Shelly
 
Introduction to SQL.pptx
Introduction to SQL.pptxIntroduction to SQL.pptx
Introduction to SQL.pptx
shubhidas
 

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
 
database management system: sql commands lab sql
database management system: sql commands lab sqldatabase management system: sql commands lab sql
database management system: sql commands lab sql
 
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
 

Recently uploaded

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 

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.