SlideShare a Scribd company logo
1 of 18
Download to read offline
Introduction to SQL:-
•Structured query language (SQL) is a
programming language for storing and
processing information in a relational
database.
•-> A relational database stores
information in tabular form, with
rows and columns representing
different data attributes and the
various relationships between the data
VARIOUS TYPES OF SQL COMMANDS:-
1.Data Definition Language(DDL)
2.Data Manipulation Language(DML)
3.Data Control Language(DCL)
4.Transaction Control Language(TCL)
5.Data Query Language(DCL)
FLOW CHART:
Data Definition Language:-
• DDL (Data Definition Language) is a type of SQL
command used to define data structures and
modify data. These commands are used to create or
modify the tables in SQL.
• DDL COMMANDS:
1.Create
2.Alter
3.Truncate
4.Drop
5.Rename
1.CREATE COMMAND:-
This command is used to create a new table in SQL. The
user has to give information like table name, column names,
and their datatypes.
SYNTAX:
CREATE TABLE table-name
(column1 data-type(size),
column2 data-type(size),
………………
column N data-type(size));
Ex: create table student( sno number(3),
sname varchar2(10),
saddress varchar2(10));
2. ALTER COMMAND:-
•To change the structure of a table. This change could
be either modify an existing attribute or add a new
attribute.
• SYNTAX:
ALTER TABLE table-name {ADD / MODIFY} (column1
datatype1);
• Ex1: alter table stu add (sname varchar2(15));
• Ex2: alter table stu modify(sname char(6));
3.TRUNCATE COMMAND:-
To remove all rows from a table we can use ‘truncate’
command.
•SYNTAX: TRUNCATE TABLE <tablename>
Ex: TRUNCATE table stu;
4.DROP COMMAND:-
The drop command can be used to drop a table.
SYNTAX: DROP TABLE table_name;
Ex: drop table stu;
5.RENAME COMMAND:-
Rename command can be used to change the
name of an exiting table.
SYNTAX: RENAME <old name> to <new name>;
Ex: rename stu to student;
DATA MANIPULATION LANGUAGE:-
• A data manipulation language (DML) is a
computer programming language used for
adding , deleting, and modifying data in a
database.
•DML COMMANDS:
•1.Insert
•2.Update
•3.Delete
•4.Merge
INSERT COMMAND:-
The insert command is used to add rows to a table .
SYNTAX: insert into <tablename> values(a list of data values):
Ex: insert into student values (101, ‘brahmam’, ‘gnt’);
2.UPDATE COMMAND:-
An update statement changes the data of one or more records in a
table.
SYNTAX: update table_name SET column1 = value1, column2 =
value2,… WHERE condition;
Ex: UPDATE customers SET contact name = ‘Vishnu’, city = ‘viz’
WHERE customer id =1;
DELETE COMMAND:-
• The delete statement is used to remove one or more
records from a table.
• SYNTAX:
DELETE FROM table_name WHERE condition;
• Ex:
delete from customer where customer name = ‘Vishnu’;
DATA CONTROL LANGUAGE (DCL):-
• DCL commands are used to enforce database security in a
multiple user database environment.
• Only Database Administrator’s or owners of the database
object can provide /remove privileges on a database object.
• Two types of DCL commands. They are,
GRANT COMMAND
 REVOKE COMMAND
GRANT COMMAND:-
• GRANT is a command used to provide access or privileges on
the database objects to the users.
• SYNTAX: grant privileges on <object name> to <user name>;
Ex:GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USE
R, ANOTHER_USER;
•  REVOKE COMMAND:- The REVOKE command user access
rights or privileges to the database objects.
• SYNTAX: revoke privileges on <object name> from <user
name>;
• Ex:
REVOKE SELECT, UPDATE ON MY_TABLE FROM U
SER1, USER2;
TRANSACTION CONTROL LANGUAGE(TCL):-
• Transaction changes can be made permanent to a database
only if they are committed. A transaction executable
statements and end explicitly with their rollback or commit
statement and implicity.
Commit
Rollback
Save point
CON…
• COMMIT:- Commit command is used to save all the
transactions to the database.
• SYNTAX: COMMIT;
• Rollback:- Rollback command is used to undo transactions
that have not already been saved to the database.
• SYNTAX: ROLLBACK;
• Ex: delete from customers where age =25;
• ROLLBACK;
• SAVEPOINT:- It is used to roll the transaction back to a
certain point without rolling back the entire transaction.
• SYNTAX: SAVEPOINT savepoint_name;
DATA QUERY LANGUAGE(DQL):-DQL is used
to fetch the data from the database
• It uses only one command i.e, SELECT
• SELECT: This is the same as the projection
operation of relational algebra. It is used to
select the attribute based on the condition
described by WHERE clause.
1.SYNTAX:SELECT expressions
2.FROM TABLES
3.WHERE conditions;
Ex: SELECT emp_name
FROM employee
WHERE age > 20;
COMMANDS PPT(1).pdf

More Related Content

Similar to COMMANDS PPT(1).pdf

Similar to COMMANDS PPT(1).pdf (20)

hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptxhjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
 
Himani uppal-221302130 WP ppt.pptx
Himani uppal-221302130  WP ppt.pptxHimani uppal-221302130  WP ppt.pptx
Himani uppal-221302130 WP ppt.pptx
 
Database Management System (DBMS).pptx
Database Management System (DBMS).pptxDatabase Management System (DBMS).pptx
Database Management System (DBMS).pptx
 
SQL-SHORT-NOTES.pptx
SQL-SHORT-NOTES.pptxSQL-SHORT-NOTES.pptx
SQL-SHORT-NOTES.pptx
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Rdbms day3
Rdbms day3Rdbms day3
Rdbms day3
 
Oracle SQL AND PL/SQL
Oracle SQL AND PL/SQLOracle SQL AND PL/SQL
Oracle SQL AND PL/SQL
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
intro for sql
intro for sql intro for sql
intro for sql
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
 
Dbmsmanual
DbmsmanualDbmsmanual
Dbmsmanual
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
DML & DCL.pptx
DML & DCL.pptxDML & DCL.pptx
DML & DCL.pptx
 
Sql queries
Sql queriesSql queries
Sql queries
 
Sql
SqlSql
Sql
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 

Recently uploaded

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 

Recently uploaded (20)

Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 

COMMANDS PPT(1).pdf

  • 1.
  • 2. Introduction to SQL:- •Structured query language (SQL) is a programming language for storing and processing information in a relational database. •-> A relational database stores information in tabular form, with rows and columns representing different data attributes and the various relationships between the data
  • 3. VARIOUS TYPES OF SQL COMMANDS:- 1.Data Definition Language(DDL) 2.Data Manipulation Language(DML) 3.Data Control Language(DCL) 4.Transaction Control Language(TCL) 5.Data Query Language(DCL)
  • 5. Data Definition Language:- • DDL (Data Definition Language) is a type of SQL command used to define data structures and modify data. These commands are used to create or modify the tables in SQL. • DDL COMMANDS: 1.Create 2.Alter 3.Truncate 4.Drop 5.Rename
  • 6. 1.CREATE COMMAND:- This command is used to create a new table in SQL. The user has to give information like table name, column names, and their datatypes. SYNTAX: CREATE TABLE table-name (column1 data-type(size), column2 data-type(size), ……………… column N data-type(size)); Ex: create table student( sno number(3), sname varchar2(10), saddress varchar2(10));
  • 7. 2. ALTER COMMAND:- •To change the structure of a table. This change could be either modify an existing attribute or add a new attribute. • SYNTAX: ALTER TABLE table-name {ADD / MODIFY} (column1 datatype1); • Ex1: alter table stu add (sname varchar2(15)); • Ex2: alter table stu modify(sname char(6));
  • 8. 3.TRUNCATE COMMAND:- To remove all rows from a table we can use ‘truncate’ command. •SYNTAX: TRUNCATE TABLE <tablename> Ex: TRUNCATE table stu; 4.DROP COMMAND:- The drop command can be used to drop a table. SYNTAX: DROP TABLE table_name; Ex: drop table stu;
  • 9. 5.RENAME COMMAND:- Rename command can be used to change the name of an exiting table. SYNTAX: RENAME <old name> to <new name>; Ex: rename stu to student;
  • 10. DATA MANIPULATION LANGUAGE:- • A data manipulation language (DML) is a computer programming language used for adding , deleting, and modifying data in a database. •DML COMMANDS: •1.Insert •2.Update •3.Delete •4.Merge
  • 11. INSERT COMMAND:- The insert command is used to add rows to a table . SYNTAX: insert into <tablename> values(a list of data values): Ex: insert into student values (101, ‘brahmam’, ‘gnt’); 2.UPDATE COMMAND:- An update statement changes the data of one or more records in a table. SYNTAX: update table_name SET column1 = value1, column2 = value2,… WHERE condition; Ex: UPDATE customers SET contact name = ‘Vishnu’, city = ‘viz’ WHERE customer id =1;
  • 12. DELETE COMMAND:- • The delete statement is used to remove one or more records from a table. • SYNTAX: DELETE FROM table_name WHERE condition; • Ex: delete from customer where customer name = ‘Vishnu’;
  • 13. DATA CONTROL LANGUAGE (DCL):- • DCL commands are used to enforce database security in a multiple user database environment. • Only Database Administrator’s or owners of the database object can provide /remove privileges on a database object. • Two types of DCL commands. They are, GRANT COMMAND  REVOKE COMMAND
  • 14. GRANT COMMAND:- • GRANT is a command used to provide access or privileges on the database objects to the users. • SYNTAX: grant privileges on <object name> to <user name>; Ex:GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USE R, ANOTHER_USER; •  REVOKE COMMAND:- The REVOKE command user access rights or privileges to the database objects. • SYNTAX: revoke privileges on <object name> from <user name>; • Ex: REVOKE SELECT, UPDATE ON MY_TABLE FROM U SER1, USER2;
  • 15. TRANSACTION CONTROL LANGUAGE(TCL):- • Transaction changes can be made permanent to a database only if they are committed. A transaction executable statements and end explicitly with their rollback or commit statement and implicity. Commit Rollback Save point
  • 16. CON… • COMMIT:- Commit command is used to save all the transactions to the database. • SYNTAX: COMMIT; • Rollback:- Rollback command is used to undo transactions that have not already been saved to the database. • SYNTAX: ROLLBACK; • Ex: delete from customers where age =25; • ROLLBACK; • SAVEPOINT:- It is used to roll the transaction back to a certain point without rolling back the entire transaction. • SYNTAX: SAVEPOINT savepoint_name;
  • 17. DATA QUERY LANGUAGE(DQL):-DQL is used to fetch the data from the database • It uses only one command i.e, SELECT • SELECT: This is the same as the projection operation of relational algebra. It is used to select the attribute based on the condition described by WHERE clause. 1.SYNTAX:SELECT expressions 2.FROM TABLES 3.WHERE conditions; Ex: SELECT emp_name FROM employee WHERE age > 20;