SlideShare uma empresa Scribd logo
1 de 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)

Mais conteúdo relacionado

Mais procurados (20)

basic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptxbasic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptx
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Basic DBMS ppt
Basic DBMS pptBasic DBMS ppt
Basic DBMS ppt
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Mysql
MysqlMysql
Mysql
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Database language
Database languageDatabase language
Database language
 
Rdbms
RdbmsRdbms
Rdbms
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
RDBMS
RDBMSRDBMS
RDBMS
 

Semelhante a SQL(DDL & DML)

Semelhante a 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
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Último (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

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.