SlideShare a Scribd company logo
1 of 20
Class Presentation
• SQL
• (DDL & DML)
• Submitted By: Submitted To:
• Sharad Dubey Vani Mam
•
SQL
• SQL is Structured Query Language, which is a
computer language for storing, manipulating
and retrieving data stored in a relational
database.
• SQL was the first commercial language
introduced for E.F Codd's Relational model.
• Today almost all RDBMS ( MySql, Oracle,
Infomix, Sybase, MS Access) uses SQL as the
standard database language..
• SQL functions fit into two broad categories :
–Data definition language (DDL)
–Data manipulation language (DML)
• Based on relational algebra, but not entirely
identical.
–Relations  Tables
–Tuples  Rows
–Attributes  Columns
DML
• Data Manipulation Language (DML)
statements are used for managing data within
database.
• DML commands are not auto-committed. It
means changes are not permanent to
database, they can be rolled back.
Command Description
insert to insert a new row
update to update existing row
delete to delete a row
merge merging two rows or two tables
DML Commands
Insert Command
• Insert command is used to insert data into a
table.
• Following is its general syntax,
INSERT into table-name values(data1,data2.)
• For e.g.-
Consider a table Student with following fields.
S_id S_Name age
• INSERT into Student values(101,'Adam',15);
The above command will insert a record
into Student table.
S_id S_Name age
101 Adam 15
Update Command
• Update command is used to update a row of a
table.
• Following is its general syntax,
UPDATE table-name set column-name = value
where condition;
S_id S_Name age
101 Adam 15
102 Alex 18
103 chris 14
• UPDATE Student set s_name='Abhi',age=17
where s_id=103;
The above command will update two columns
of a record.
S_id S_Name age
101 Adam 15
102 Alex 18
103 Abhi 17
Delete command
• Delete command is used to delete data from a
table. Delete command can also be used with
condition to delete a particular row.
• Following is its general syntax,
DELETE from table-name ;
• Example to Delete all Records from a Table:
DELETE from Student;
The above command will delete all the records
from Student table.
Example to Delete a particular Record from a
Table
S_id S_Name age
101 Adam 15
102 Alex 18
103 Abhi 17
• Consider the following Student table
DELETE from Student where s_id=103;
The above command will delete the record
where s_id is 103 from Student table.
S_id S_Name age
101 Adam 15
102 Alex 18
DDL
• Data Definition Language (DDL) statements
are used to define the database structure or
schema.
• All DDL commands are auto-committed. That
means it saves all the changes permanently in
the database.
DDL Commands
Command Description
create to create new table or database
alter for alteration
truncate delete data from table
drop to drop a table
rename to rename a table
Create Command
• Create is a DDL command used to create a
table or a database.
• Following is the Syntax,
create database database-name;
• Example for Creating Database,
create database Test;
Alter Command
• Alter command is used for alteration of table
structures. There are various uses
of alter command, such as,
to add a column to existing table
to rename any existing column
to change datatype of any column or to
modify its size.
alter is also used to drop a column
Truncate Command
• Truncate command removes all records from
a table. But this command will not destroy the
table's structure. When we apply truncate
command on a table its Primary key is
initialized.
• Following is its Syntax,
truncate table table-name;
Drop Command
• Drop query completely removes a table from
database. This command will also destroy the
table structure.
• Following is its Syntax,
drop table table-name;
• For Example-
drop table Student;
Rename Command
• Rename command is used to rename a table.
• Following is its Syntax,
rename table old-table-name to new-table-name;
• For Example-
rename table Student to Student-record;
The above query will rename Student table
to Student-record.
SQL(DDL & DML)

More Related Content

What's hot (20)

SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
DML Commands
DML CommandsDML Commands
DML Commands
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Sql commands
Sql commandsSql commands
Sql commands
 
Database language
Database languageDatabase language
Database language
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Mysql
MysqlMysql
Mysql
 
Sql commands
Sql commandsSql commands
Sql commands
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
 
SQL DDL
SQL DDLSQL DDL
SQL DDL
 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
 

Similar to SQL(DDL & DML)

Similar to SQL(DDL & DML) (20)

Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
UNIT2.ppt
UNIT2.pptUNIT2.ppt
UNIT2.ppt
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
SQL-SHORT-NOTES.pptx
SQL-SHORT-NOTES.pptxSQL-SHORT-NOTES.pptx
SQL-SHORT-NOTES.pptx
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
 
8. sql
8. sql8. sql
8. sql
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
Himani uppal-221302130 WP ppt.pptx
Himani uppal-221302130  WP ppt.pptxHimani uppal-221302130  WP ppt.pptx
Himani uppal-221302130 WP ppt.pptx
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
Java class 8
Java class 8Java class 8
Java class 8
 
GFGC CHIKKABASUR ( DDL COMMANDS )
GFGC CHIKKABASUR ( DDL COMMANDS )GFGC CHIKKABASUR ( DDL COMMANDS )
GFGC CHIKKABASUR ( DDL COMMANDS )
 
Sql tables
Sql tablesSql tables
Sql tables
 
STRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGESTRUCTURED QUERY LANGUAGE
STRUCTURED QUERY LANGUAGE
 
SQL Queries - DDL Commands
SQL Queries - DDL CommandsSQL Queries - DDL Commands
SQL Queries - DDL Commands
 
Sql statements function join
Sql statements function joinSql statements function join
Sql statements function join
 

Recently uploaded

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 

Recently uploaded (20)

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

SQL(DDL & DML)

  • 1. Class Presentation • SQL • (DDL & DML) • Submitted By: Submitted To: • Sharad Dubey Vani Mam •
  • 2. SQL • SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in a relational database. • SQL was the first commercial language introduced for E.F Codd's Relational model. • Today almost all RDBMS ( MySql, Oracle, Infomix, Sybase, MS Access) uses SQL as the standard database language..
  • 3. • SQL functions fit into two broad categories : –Data definition language (DDL) –Data manipulation language (DML) • Based on relational algebra, but not entirely identical. –Relations  Tables –Tuples  Rows –Attributes  Columns
  • 4. DML • Data Manipulation Language (DML) statements are used for managing data within database. • DML commands are not auto-committed. It means changes are not permanent to database, they can be rolled back.
  • 5. Command Description insert to insert a new row update to update existing row delete to delete a row merge merging two rows or two tables DML Commands
  • 6. Insert Command • Insert command is used to insert data into a table. • Following is its general syntax, INSERT into table-name values(data1,data2.) • For e.g.- Consider a table Student with following fields. S_id S_Name age
  • 7. • INSERT into Student values(101,'Adam',15); The above command will insert a record into Student table. S_id S_Name age 101 Adam 15
  • 8. Update Command • Update command is used to update a row of a table. • Following is its general syntax, UPDATE table-name set column-name = value where condition; S_id S_Name age 101 Adam 15 102 Alex 18 103 chris 14
  • 9. • UPDATE Student set s_name='Abhi',age=17 where s_id=103; The above command will update two columns of a record. S_id S_Name age 101 Adam 15 102 Alex 18 103 Abhi 17
  • 10. Delete command • Delete command is used to delete data from a table. Delete command can also be used with condition to delete a particular row. • Following is its general syntax, DELETE from table-name ; • Example to Delete all Records from a Table: DELETE from Student; The above command will delete all the records from Student table.
  • 11. Example to Delete a particular Record from a Table S_id S_Name age 101 Adam 15 102 Alex 18 103 Abhi 17 • Consider the following Student table
  • 12. DELETE from Student where s_id=103; The above command will delete the record where s_id is 103 from Student table. S_id S_Name age 101 Adam 15 102 Alex 18
  • 13. DDL • Data Definition Language (DDL) statements are used to define the database structure or schema. • All DDL commands are auto-committed. That means it saves all the changes permanently in the database.
  • 14. DDL Commands Command Description create to create new table or database alter for alteration truncate delete data from table drop to drop a table rename to rename a table
  • 15. Create Command • Create is a DDL command used to create a table or a database. • Following is the Syntax, create database database-name; • Example for Creating Database, create database Test;
  • 16. Alter Command • Alter command is used for alteration of table structures. There are various uses of alter command, such as, to add a column to existing table to rename any existing column to change datatype of any column or to modify its size. alter is also used to drop a column
  • 17. Truncate Command • Truncate command removes all records from a table. But this command will not destroy the table's structure. When we apply truncate command on a table its Primary key is initialized. • Following is its Syntax, truncate table table-name;
  • 18. Drop Command • Drop query completely removes a table from database. This command will also destroy the table structure. • Following is its Syntax, drop table table-name; • For Example- drop table Student;
  • 19. Rename Command • Rename command is used to rename a table. • Following is its Syntax, rename table old-table-name to new-table-name; • For Example- rename table Student to Student-record; The above query will rename Student table to Student-record.