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

1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 

What's hot (20)

introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
DML Commands
DML CommandsDML Commands
DML Commands
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Database language
Database languageDatabase language
Database language
 
DDL And DML
DDL And DMLDDL And DML
DDL And DML
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Sql commands
Sql commandsSql commands
Sql commands
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptx
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Mysql
MysqlMysql
Mysql
 
DBMS: Types of keys
DBMS:  Types of keysDBMS:  Types of keys
DBMS: Types of keys
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 

Similar to SQL(DDL & DML)

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
PavithSingh
 
Java class 8
Java class 8Java class 8
Java class 8
Edureka!
 

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

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
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
heathfieldcps1
 

Recently uploaded (20)

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
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.
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
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
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
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
 
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
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 

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.