SlideShare una empresa de Scribd logo
1 de 13
INTRODUCTION
 SQL commands are instructions
used to communicate with the
database to perform specific task
that work with data.
 SQL commands can be used not
only for searching the database but
also to perform various other
functions for example, you can
create tables, add data to tables, or
modify data, drop the table, set
DATA MANIPULATION LANGUAGE
 A DATA MANIPULATION
LANGUAGE (DML) is a set of syntax that
contains SQL commands that are used for
storing, retrieving, modifying, and deleting
data.
 These commands are:
SELECT
INSERT
UPDATE
DELETE.
SELECT COMMAND
USE
 Select command is used to view records from
the table. To view all columns and all rows * can
be specified with select statement.
 If user needs to view only certain fields or
columns, then by specifying the names of those
certain fields, columns user can acquire its
output.
SYNTAX
 SELECT * from table_name.
 SELECT <Column_name> from table_name.
TABLE T QUERY RESULT
C1 C2 SELECT * FROM T; C1 C2
1 a 1 a
2 b 2 b
C1 C2 SELECT C1 FROM T; C1
1 a 1
2 b 2
C1 C2 SELECT * FROM T WHERE C1
=1;
C1 C2
1 a
1 a
2 b
EXAMPLE
DELETE COMMAND
USE
 Delete command is used to delete records in the
table.
 In SQL, Delete is used to delete rows in the
table.
 It is possible to delete all rows in a table without
deleting the table.
 This means that table structure, attributes and
indexes will be intact.
NOTE
 Be very careful when deleting records, you
SYNTAX
• DELETE * from table_name [WHERE CONDITION]
(if where condition is not used all rows in the table are
removed)
EXAMPLE
• DELETE from customer
WHERE CustomerName=‘Anil Khade’ AND
ContactName=‘Vikrant Kedare’
TABLE NAME: person
Sr no. P_id p_name
1 120 Jack
2 121 Rose
3 122 Ram
4 123 Sita
 If you want to delete row 1 then,
DELETE * person WHERE p_name=‘Jack’;
1st Row will be deleted.
Sr no. p_id p_name
2 121 Rose
3 122 Ram
4 123 Sita
EXAMPLE
UPDATE COMMAND
USE
 An SQL UPDATE statement changes the data of
one or more records in a table.
 Either all the rows can be updated, or a subset may
be chosen using a condition.
SYNTAX
UPDATE table_name SET column_name = valu
e [, column_name = value ...]
[WHERE condition]
EXAMPLE
 UPDATE employee SET location ='Mysore'
WHERE id = 101;
Table Name: person
p_id p_name
1 121 Jack
2 122 Rose
3 123 Ram
 If you want to update row 1 then,
UPDATE person SET p_name=‘Sita’
WHERE id = 121;
p_id p_name
1 121 Sita
2 122 Rose
3 123 Ram
EXAMPLE
INSERT COMMAND
USE
 An SQL INSERT statement adds one or more
records to any single table in a relational
database.
SYNTAX
 INSERT INTO table_name
VALUES (value1, value2, value3,...valueN);
EXAMPLE
 INSERT INTO person
VALUES (124, ‘Laxman’);
Table Name:person
p_id p_name
1 121 Jack
2 122 Rose
3 123 Ram
 If you want to insert data in 4th row then,
INSERT INTO person
Values(124, ‘Sita’);
p_id p_name
1 121 Jack
2 122 Rose
3 123 Ram
4 124 Sita
EXAMPLE
Commands of DML in SQL

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

SQL commands
SQL commandsSQL commands
SQL commands
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLE
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
8. sql
8. sql8. sql
8. sql
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 
Best sql plsql material
Best sql plsql materialBest sql plsql material
Best sql plsql material
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
 
Writing Basic SQL SELECT Statements
Writing Basic SQL SELECT StatementsWriting Basic SQL SELECT Statements
Writing Basic SQL SELECT Statements
 
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
 
Sql Constraints
Sql ConstraintsSql Constraints
Sql Constraints
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 
Sql clauses by Manan Pasricha
Sql clauses by Manan PasrichaSql clauses by Manan Pasricha
Sql clauses by Manan Pasricha
 

Similar a Commands of DML in SQL

Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
Prabu Cse
 
ii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docxii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docx
lakshmi77
 
06.01 sql select distinct
06.01 sql select distinct06.01 sql select distinct
06.01 sql select distinct
Bishal Ghimire
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
Belle Wx
 

Similar a Commands of DML in SQL (20)

DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
 
Babitha2.mysql
Babitha2.mysqlBabitha2.mysql
Babitha2.mysql
 
Babitha2 Mysql
Babitha2 MysqlBabitha2 Mysql
Babitha2 Mysql
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 
Oracle: DML
Oracle: DMLOracle: DML
Oracle: DML
 
Oracle : DML
Oracle : DMLOracle : DML
Oracle : DML
 
Prabu's sql quries
Prabu's sql quries Prabu's sql quries
Prabu's sql quries
 
ii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docxii bcom dbms SQL Commands.docx
ii bcom dbms SQL Commands.docx
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
 
SQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint PresentationSQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint Presentation
 
06.01 sql select distinct
06.01 sql select distinct06.01 sql select distinct
06.01 sql select distinct
 
Sql
SqlSql
Sql
 
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
 
GFGC CHIKKABASUR ( DDL COMMANDS )
GFGC CHIKKABASUR ( DDL COMMANDS )GFGC CHIKKABASUR ( DDL COMMANDS )
GFGC CHIKKABASUR ( DDL COMMANDS )
 
Commands
CommandsCommands
Commands
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
 
Sql basics v2
Sql basics v2Sql basics v2
Sql basics v2
 
Oracle naveen Sql
Oracle naveen   SqlOracle naveen   Sql
Oracle naveen Sql
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Commands of DML in SQL

  • 1.
  • 2. INTRODUCTION  SQL commands are instructions used to communicate with the database to perform specific task that work with data.  SQL commands can be used not only for searching the database but also to perform various other functions for example, you can create tables, add data to tables, or modify data, drop the table, set
  • 3. DATA MANIPULATION LANGUAGE  A DATA MANIPULATION LANGUAGE (DML) is a set of syntax that contains SQL commands that are used for storing, retrieving, modifying, and deleting data.  These commands are: SELECT INSERT UPDATE DELETE.
  • 4. SELECT COMMAND USE  Select command is used to view records from the table. To view all columns and all rows * can be specified with select statement.  If user needs to view only certain fields or columns, then by specifying the names of those certain fields, columns user can acquire its output. SYNTAX  SELECT * from table_name.  SELECT <Column_name> from table_name.
  • 5. TABLE T QUERY RESULT C1 C2 SELECT * FROM T; C1 C2 1 a 1 a 2 b 2 b C1 C2 SELECT C1 FROM T; C1 1 a 1 2 b 2 C1 C2 SELECT * FROM T WHERE C1 =1; C1 C2 1 a 1 a 2 b EXAMPLE
  • 6. DELETE COMMAND USE  Delete command is used to delete records in the table.  In SQL, Delete is used to delete rows in the table.  It is possible to delete all rows in a table without deleting the table.  This means that table structure, attributes and indexes will be intact. NOTE  Be very careful when deleting records, you
  • 7. SYNTAX • DELETE * from table_name [WHERE CONDITION] (if where condition is not used all rows in the table are removed) EXAMPLE • DELETE from customer WHERE CustomerName=‘Anil Khade’ AND ContactName=‘Vikrant Kedare’
  • 8. TABLE NAME: person Sr no. P_id p_name 1 120 Jack 2 121 Rose 3 122 Ram 4 123 Sita  If you want to delete row 1 then, DELETE * person WHERE p_name=‘Jack’; 1st Row will be deleted. Sr no. p_id p_name 2 121 Rose 3 122 Ram 4 123 Sita EXAMPLE
  • 9. UPDATE COMMAND USE  An SQL UPDATE statement changes the data of one or more records in a table.  Either all the rows can be updated, or a subset may be chosen using a condition. SYNTAX UPDATE table_name SET column_name = valu e [, column_name = value ...] [WHERE condition] EXAMPLE  UPDATE employee SET location ='Mysore' WHERE id = 101;
  • 10. Table Name: person p_id p_name 1 121 Jack 2 122 Rose 3 123 Ram  If you want to update row 1 then, UPDATE person SET p_name=‘Sita’ WHERE id = 121; p_id p_name 1 121 Sita 2 122 Rose 3 123 Ram EXAMPLE
  • 11. INSERT COMMAND USE  An SQL INSERT statement adds one or more records to any single table in a relational database. SYNTAX  INSERT INTO table_name VALUES (value1, value2, value3,...valueN); EXAMPLE  INSERT INTO person VALUES (124, ‘Laxman’);
  • 12. Table Name:person p_id p_name 1 121 Jack 2 122 Rose 3 123 Ram  If you want to insert data in 4th row then, INSERT INTO person Values(124, ‘Sita’); p_id p_name 1 121 Jack 2 122 Rose 3 123 Ram 4 124 Sita EXAMPLE