SlideShare a Scribd company logo
1 of 32
About Me
Md. Selim Hossain
Lecturer
Dept. of CSE
UTTARA UNIVERSITY
House#05, Section#06,
Road#15, Uttara, Dhaka-1230.
Md. Selim Hossain 1
Database
Management
System
(DBMS)
Md. Selim Hossain 2
Topics for Today
Md. Selim Hossain 3
Data Definition Language (DDL)
Data Manipulation Language
(DML)
Md. Selim Hossain 4
SQL statements are divided into two major
categories:
Data Definition Language (DDL) and
Data Manipulation Language (DML).
Md. Selim Hossain 5
Data Definition Language (DDL)
• DDL statements are used to build and modify
the structure of tables and other objects in
the database.
• DDL is a sub-language of SQL used to create
and manipulate objects in a database. DDL
provides the following statements to
manipulate the object in database:
CREATE, ALTER, DROP, TRUNCATE, RENAME
Md. Selim Hossain 6
Data Definition Language (DDL)
CREATE statement
(to create objects in the database):
• The CREATE statement in SQL creates a
component in a relational database
management system (RDBMS).
• The CREATE command is used to establish a
new database, table, index, or stored
procedure.
Md. Selim Hossain 7
CREATE TABLE statement
• A commonly used CREATE command is the
CREATE TABLE command. The typical usage is:
CREATE TABLE [table name] ( [column
definitions] ) [table parameters]
Md. Selim Hossain 8
CREATE TABLE statement
• An example of statement to create a table
named employees with a few columns is:
Md. Selim Hossain 9
CREATE TABLE statement
Note: The full structure of table can be viewed
with the DESC command.
DESC <TABLE_NAME>
Md. Selim Hossain 10
DROP statement
• The DROP statement destroys an existing
database, table, index, or view.
• A DROP statement in SQL removes a
component from a relational database
management system (RDBMS).
• Drop statement is used to delete an existing
object from the database. It can also be used
to delete any column from a table.
Md. Selim Hossain 11
DROP statement
• The DROP statement is distinct from the
DELETE and TRUNCATE statements, in that
DELETE and TRUNCATE do not remove the
table itself. For example, a DELETE statement
might delete some (or all) data from a table
while leaving the table itself in the database,
whereas a DROP statement removes the
entire table from the database.
Md. Selim Hossain 12
DROP statement
Md. Selim Hossain 13
DROP statement
The typical usage is simply:
• For example, the command to drop a table
named employees is:
Md. Selim Hossain 14
ALTER statement
• The ALTER statement modifies an existing
database object or, Alter statement is used to
modify the structure of an existing object.
• Below alteration can be done on a table:
o Addition of new columns
o Deletion of existing columns
o Changing the data type of columns
o Changing the size of columns
Md. Selim Hossain 15
ALTER statement
• The typical usage is:
Md. Selim Hossain 16
ALTER statement
Note: To change the data type of a column,
the column must be empty.
Md. Selim Hossain 17
RENAME statement
Rename statement is used to rename an
existing object from a database
Md. Selim Hossain 18
RENAME statement
• The RENAME statement is used to rename a
database table.
Md. Selim Hossain 19
TRUNCATE statement
• The TRUNCATE statement is used to delete all
data from a table. It's much faster than
DELETE.
Md. Selim Hossain 20
Data Manipulation Language (DML)
• A data manipulation language (DML) is a
family of syntax elements similar to a
computer programming language used for
selecting, inserting, deleting and updating
data in a database.
Md. Selim Hossain 21
Data Manipulation Language (DML)
 DML also known as query language
Two classes of languages
 Procedural – user specifies what data is
required and how to get those data
 Nonprocedural – user specifies what data is
required without specifying how to get
those data
Md. Selim Hossain 22
Data Manipulation Language (DML)
• DML is a sub-language of SQL. It is used to
manipulate the data stored in a table.
• DML provides the following statements for
data manipulation:
INSERT
UPDATE
DELETE
Md. Selim Hossain 23
Data Manipulation Language (DML)
INSERT Statement
• INSERT statement is used to insert a new
record into a table.
Md. Selim Hossain 24
Data Manipulation Language (DML)
INSERT Statement
• Example
• Consider a table 'EMP' having columns
named EMPNO, NAME, SAL and JOB. We can
be used the below INSERT statement to insert
a new record to it.
Md. Selim Hossain 25
UPDATE Statement
• Update statement is used to update an
existing record in a table.
Md. Selim Hossain 26
UPDATE Statement
• If the where clause of omitted, the statement
will update all the values in the particular
column.
Md. Selim Hossain 27
UPDATE Statement
• Note: IS NULL is used for assignment and =NULL
is used to recognize.
Md. Selim Hossain 28
DELETE Statement
• Delete Statement is used to delete records from
a table.
Md. Selim Hossain 29
DELETE Statement
Md. Selim Hossain 30
DELETE Statement
• Below statement will delete all records from
the table.
Md. Selim Hossain 31
Md. Selim Hossain
Thank you
32

More Related Content

What's hot (20)

Dbms slides
Dbms slidesDbms slides
Dbms slides
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
 
database language ppt.pptx
database language ppt.pptxdatabase language ppt.pptx
database language ppt.pptx
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
SQL commands
SQL commandsSQL commands
SQL commands
 
Dbms
DbmsDbms
Dbms
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
MySQL Data types
MySQL Data typesMySQL Data types
MySQL Data types
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Data Base Management System
Data Base Management SystemData Base Management System
Data Base Management System
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Basic Concept of Database
Basic Concept of DatabaseBasic Concept of Database
Basic Concept of Database
 
Sql commands
Sql commandsSql commands
Sql commands
 
Data dictionary
Data dictionaryData dictionary
Data dictionary
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
Files Vs DataBase
Files Vs DataBaseFiles Vs DataBase
Files Vs DataBase
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 

Viewers also liked

How to Earn the Attention of Today's Buyer
How to Earn the Attention of Today's BuyerHow to Earn the Attention of Today's Buyer
How to Earn the Attention of Today's BuyerHubSpot
 
25 Discovery Call Questions
25 Discovery Call Questions25 Discovery Call Questions
25 Discovery Call QuestionsHubSpot
 
Behind the Scenes: Launching HubSpot Tokyo
Behind the Scenes: Launching HubSpot TokyoBehind the Scenes: Launching HubSpot Tokyo
Behind the Scenes: Launching HubSpot TokyoHubSpot
 
Add the Women Back: Wikipedia Edit-a-Thon
Add the Women Back: Wikipedia Edit-a-ThonAdd the Women Back: Wikipedia Edit-a-Thon
Add the Women Back: Wikipedia Edit-a-ThonHubSpot
 
Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php Mudasir Syed
 
String Manipulation in PHP
String Manipulation in PHPString Manipulation in PHP
String Manipulation in PHPSuraj Motee
 
Unlocking The Value Of Your Information
Unlocking The Value Of Your InformationUnlocking The Value Of Your Information
Unlocking The Value Of Your InformationIntergen
 
4 Value Of Information
4 Value Of Information4 Value Of Information
4 Value Of Informationpirama2000
 
Php Error Handling
Php Error HandlingPhp Error Handling
Php Error Handlingmussawir20
 
Be Helpie! gente que ayuda a gente a través de su afición
Be Helpie! gente que ayuda a gente a través de su afición Be Helpie! gente que ayuda a gente a través de su afición
Be Helpie! gente que ayuda a gente a través de su afición Miguel Pueyo
 
SQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate TableSQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate Table1keydata
 
3 reasons to stop, think, sleep | London Business School
3 reasons to stop, think, sleep | London Business School3 reasons to stop, think, sleep | London Business School
3 reasons to stop, think, sleep | London Business SchoolLondon Business School
 

Viewers also liked (17)

How to Earn the Attention of Today's Buyer
How to Earn the Attention of Today's BuyerHow to Earn the Attention of Today's Buyer
How to Earn the Attention of Today's Buyer
 
25 Discovery Call Questions
25 Discovery Call Questions25 Discovery Call Questions
25 Discovery Call Questions
 
Behind the Scenes: Launching HubSpot Tokyo
Behind the Scenes: Launching HubSpot TokyoBehind the Scenes: Launching HubSpot Tokyo
Behind the Scenes: Launching HubSpot Tokyo
 
Add the Women Back: Wikipedia Edit-a-Thon
Add the Women Back: Wikipedia Edit-a-ThonAdd the Women Back: Wikipedia Edit-a-Thon
Add the Women Back: Wikipedia Edit-a-Thon
 
Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php
 
String Manipulation in PHP
String Manipulation in PHPString Manipulation in PHP
String Manipulation in PHP
 
Unlocking The Value Of Your Information
Unlocking The Value Of Your InformationUnlocking The Value Of Your Information
Unlocking The Value Of Your Information
 
SQL JOIN Explained Visually
SQL JOIN Explained VisuallySQL JOIN Explained Visually
SQL JOIN Explained Visually
 
4 Value Of Information
4 Value Of Information4 Value Of Information
4 Value Of Information
 
Php Error Handling
Php Error HandlingPhp Error Handling
Php Error Handling
 
Mis mcq
Mis mcqMis mcq
Mis mcq
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
 
Be Helpie! gente que ayuda a gente a través de su afición
Be Helpie! gente que ayuda a gente a través de su afición Be Helpie! gente que ayuda a gente a través de su afición
Be Helpie! gente que ayuda a gente a través de su afición
 
SQL
SQLSQL
SQL
 
Php string function
Php string function Php string function
Php string function
 
SQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate TableSQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate Table
 
3 reasons to stop, think, sleep | London Business School
3 reasons to stop, think, sleep | London Business School3 reasons to stop, think, sleep | London Business School
3 reasons to stop, think, sleep | London Business School
 

Similar to Database Fundamentals DDL DML SQL (20)

SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
lovely
lovelylovely
lovely
 
Data base
Data baseData base
Data base
 
SQL-SHORT-NOTES.pptx
SQL-SHORT-NOTES.pptxSQL-SHORT-NOTES.pptx
SQL-SHORT-NOTES.pptx
 
dbms gdjdjdjehdhdjjdjdudjdjdjdhhdhdbdhdhdh
dbms gdjdjdjehdhdjjdjdudjdjdjdhhdhdbdhdhdhdbms gdjdjdjehdhdjjdjdudjdjdjdhhdhdbdhdhdh
dbms gdjdjdjehdhdjjdjdudjdjdjdhhdhdbdhdhdh
 
Web app development_my_sql_08
Web app development_my_sql_08Web app development_my_sql_08
Web app development_my_sql_08
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
Mysql
MysqlMysql
Mysql
 
Ddl vs dml
Ddl vs dmlDdl vs dml
Ddl vs dml
 
SQL2.pptx
SQL2.pptxSQL2.pptx
SQL2.pptx
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
Structured Query Language
Structured Query LanguageStructured Query Language
Structured Query Language
 
Basics of dml queries
Basics of dml queriesBasics of dml queries
Basics of dml queries
 
Database Languges
Database LangugesDatabase Languges
Database Languges
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
DBMS Part-3.pptx
DBMS Part-3.pptxDBMS Part-3.pptx
DBMS Part-3.pptx
 
Introduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQLIntroduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQL
 
sql ppt.pptx
sql ppt.pptxsql ppt.pptx
sql ppt.pptx
 
Sql queries
Sql queriesSql queries
Sql queries
 
SQL
SQLSQL
SQL
 

Recently uploaded

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 

Recently uploaded (20)

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 

Database Fundamentals DDL DML SQL

  • 1. About Me Md. Selim Hossain Lecturer Dept. of CSE UTTARA UNIVERSITY House#05, Section#06, Road#15, Uttara, Dhaka-1230. Md. Selim Hossain 1
  • 3. Topics for Today Md. Selim Hossain 3
  • 4. Data Definition Language (DDL) Data Manipulation Language (DML) Md. Selim Hossain 4
  • 5. SQL statements are divided into two major categories: Data Definition Language (DDL) and Data Manipulation Language (DML). Md. Selim Hossain 5
  • 6. Data Definition Language (DDL) • DDL statements are used to build and modify the structure of tables and other objects in the database. • DDL is a sub-language of SQL used to create and manipulate objects in a database. DDL provides the following statements to manipulate the object in database: CREATE, ALTER, DROP, TRUNCATE, RENAME Md. Selim Hossain 6
  • 7. Data Definition Language (DDL) CREATE statement (to create objects in the database): • The CREATE statement in SQL creates a component in a relational database management system (RDBMS). • The CREATE command is used to establish a new database, table, index, or stored procedure. Md. Selim Hossain 7
  • 8. CREATE TABLE statement • A commonly used CREATE command is the CREATE TABLE command. The typical usage is: CREATE TABLE [table name] ( [column definitions] ) [table parameters] Md. Selim Hossain 8
  • 9. CREATE TABLE statement • An example of statement to create a table named employees with a few columns is: Md. Selim Hossain 9
  • 10. CREATE TABLE statement Note: The full structure of table can be viewed with the DESC command. DESC <TABLE_NAME> Md. Selim Hossain 10
  • 11. DROP statement • The DROP statement destroys an existing database, table, index, or view. • A DROP statement in SQL removes a component from a relational database management system (RDBMS). • Drop statement is used to delete an existing object from the database. It can also be used to delete any column from a table. Md. Selim Hossain 11
  • 12. DROP statement • The DROP statement is distinct from the DELETE and TRUNCATE statements, in that DELETE and TRUNCATE do not remove the table itself. For example, a DELETE statement might delete some (or all) data from a table while leaving the table itself in the database, whereas a DROP statement removes the entire table from the database. Md. Selim Hossain 12
  • 14. DROP statement The typical usage is simply: • For example, the command to drop a table named employees is: Md. Selim Hossain 14
  • 15. ALTER statement • The ALTER statement modifies an existing database object or, Alter statement is used to modify the structure of an existing object. • Below alteration can be done on a table: o Addition of new columns o Deletion of existing columns o Changing the data type of columns o Changing the size of columns Md. Selim Hossain 15
  • 16. ALTER statement • The typical usage is: Md. Selim Hossain 16
  • 17. ALTER statement Note: To change the data type of a column, the column must be empty. Md. Selim Hossain 17
  • 18. RENAME statement Rename statement is used to rename an existing object from a database Md. Selim Hossain 18
  • 19. RENAME statement • The RENAME statement is used to rename a database table. Md. Selim Hossain 19
  • 20. TRUNCATE statement • The TRUNCATE statement is used to delete all data from a table. It's much faster than DELETE. Md. Selim Hossain 20
  • 21. Data Manipulation Language (DML) • A data manipulation language (DML) is a family of syntax elements similar to a computer programming language used for selecting, inserting, deleting and updating data in a database. Md. Selim Hossain 21
  • 22. Data Manipulation Language (DML)  DML also known as query language Two classes of languages  Procedural – user specifies what data is required and how to get those data  Nonprocedural – user specifies what data is required without specifying how to get those data Md. Selim Hossain 22
  • 23. Data Manipulation Language (DML) • DML is a sub-language of SQL. It is used to manipulate the data stored in a table. • DML provides the following statements for data manipulation: INSERT UPDATE DELETE Md. Selim Hossain 23
  • 24. Data Manipulation Language (DML) INSERT Statement • INSERT statement is used to insert a new record into a table. Md. Selim Hossain 24
  • 25. Data Manipulation Language (DML) INSERT Statement • Example • Consider a table 'EMP' having columns named EMPNO, NAME, SAL and JOB. We can be used the below INSERT statement to insert a new record to it. Md. Selim Hossain 25
  • 26. UPDATE Statement • Update statement is used to update an existing record in a table. Md. Selim Hossain 26
  • 27. UPDATE Statement • If the where clause of omitted, the statement will update all the values in the particular column. Md. Selim Hossain 27
  • 28. UPDATE Statement • Note: IS NULL is used for assignment and =NULL is used to recognize. Md. Selim Hossain 28
  • 29. DELETE Statement • Delete Statement is used to delete records from a table. Md. Selim Hossain 29
  • 31. DELETE Statement • Below statement will delete all records from the table. Md. Selim Hossain 31