SlideShare a Scribd company logo
1 of 14
Oracle DDL ,DML & DCL
ABDUL REHMAN
DDL
• SCHEMA
– A database schema is the skeleton structure that
represents the logical view of the entire database. It
defines how the data is organized and how the
relations among them are associated.
• DATA DEFINATION LANGUAGE
– Are collection of those statements which are DIRECTLY
related to database Schema
• DDL STATEMENTS ARE
– CREATE, ALTER, DROP, REPLACE AND TRUNCATE
CREATE
• Used To Create Objects Like
– CREATE TABLE
– CREATE FUNCTION
– CREATE VIEW
– Etc.
CREATE TABLE STUDENT
(
STDROLLNO number(5) primary key,
NAME varchar2(20),
CAST varchar2(20)
);
STDROLLNO NAME CAST
ALTER
• Use to Alter Objects like
– ALTER TABLE
– ALTER USER
– ALTER DATABASE
ALTER TABLE STUDENT ADD
(
ADDRESS NVARCHAR2(50)
);
STDROLLNO NAME CASTSTDROLLNO NAME CAST ADDRESS
DROP
• Use to Drop Objects like
– DROP TABLE
– DROP USER
– DROP FUNCTION
– Etc
CREATE TABLE EXTRA
(
NUM number(5) primary key,
NAME nvarchar2(20)
);
NUM NAME
DROP TABLE EXTRA;
REPLACE
• Use to Rename table names.
RENAME STUDENT TO STUDENTS;
STDROLLNO NAME CAST ADDRESS
TRUNCATE
• Use to truncate (delete all rows) a table.
DML
• Data manipulation language (DML)
• Are the statements query and manipulate
data in existing schema objects.
– INSERT
– UPDATE
– DELETE
INSERT
• Insert into STUDENTS values (3,’Atif’,’Bhatti’,’UK’);
• Insert into STUDENTS values
(13,’Ahsan’,’Khanzada’,’SK’);
STDROLLNO NAME CAST ADDRESS
3 Atif Bhatti UK
13 Ahsan Khanzada SK
UPDATE
• USED TO MODIFY DATA IN DB
– UPDATE STUDENTS SET ADDRESS=‘NAWABSHAH’
WHERE NAME=‘Atif”;
STDROLLNO NAME CAST ADDRESS
3 Atif Bhatti UK
13 Ahsan Khanzada SK
STDROLLNO NAME CAST ADDRESS
3 Atif Bhatti Nawabshah
13 Ahsan Khanzada SK
DELETE
• Use the DELETE statement to delete the rows
from existing tables which are in your schema
or if you have DELETE privilege on them.
• DELETE STUDENTS WHERE NAME=‘Ahsan’;
STDROLLNO NAME CAST ADDRESS
3 Atif Bhatti Nawabshah
13 Ahsan Khanzada SK
DCL
• Data Control Language (DCL) Statements
– Data Control Language Statements are used to
grant privileges on tables, views, procedures to
other users or roles.
– The DCL statements are
• GRANK
• REVOKE
GRANT
• Use to grant privileges to other users or roles.
• grant select, update, insert on STUDENTS to
David;
REVOKE
• Use to take back privileges granted to other
users and roles.
• revoke select, update, insert on emp from
David;

More Related Content

What's hot

1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQLrehaniltifat
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation LanguageJas Singh Bhasin
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)Ishucs
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL CommandsShrija Madhu
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptDrRShaliniVISTAS
 
Bootcamp sql fundamental
Bootcamp sql fundamentalBootcamp sql fundamental
Bootcamp sql fundamentalvarunbhatt23
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningOracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningeVideoTuition
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteAl-Mamun Sarkar
 

What's hot (20)

1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Normalization
NormalizationNormalization
Normalization
 
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
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
4. plsql
4. plsql4. plsql
4. plsql
 
Bootcamp sql fundamental
Bootcamp sql fundamentalBootcamp sql fundamental
Bootcamp sql fundamental
 
SQL
SQLSQL
SQL
 
ORACLE PL SQL
ORACLE PL SQLORACLE PL SQL
ORACLE PL SQL
 
Oracle Database Trigger
Oracle Database TriggerOracle Database Trigger
Oracle Database Trigger
 
Relational model
Relational modelRelational model
Relational model
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Database overview
Database overviewDatabase overview
Database overview
 
MySQL Data types
MySQL Data typesMySQL Data types
MySQL Data types
 
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningOracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
 
Stored procedure
Stored procedureStored procedure
Stored procedure
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
 

Similar to Oracle Database DML DDL and TCL

Similar to Oracle Database DML DDL and TCL (20)

Database models and DBMS languages
Database models and DBMS languagesDatabase models and DBMS languages
Database models and DBMS languages
 
98765432345671223Intro-to-PostgreSQL.ppt
98765432345671223Intro-to-PostgreSQL.ppt98765432345671223Intro-to-PostgreSQL.ppt
98765432345671223Intro-to-PostgreSQL.ppt
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
sql statements & joins
sql statements & joinssql statements & joins
sql statements & joins
 
Sql
SqlSql
Sql
 
Data base.ppt
Data base.pptData base.ppt
Data base.ppt
 
Oracle Material.pdf
Oracle Material.pdfOracle Material.pdf
Oracle Material.pdf
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
Module 3
Module 3Module 3
Module 3
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Dbms & oracle
Dbms & oracleDbms & oracle
Dbms & oracle
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
SQL
SQLSQL
SQL
 
SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10SQL WORKSHOP::Lecture 10
SQL WORKSHOP::Lecture 10
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
 
SQL: Data Definition Language commands.pptx
SQL: Data Definition Language commands.pptxSQL: Data Definition Language commands.pptx
SQL: Data Definition Language commands.pptx
 

More from Abdul Rehman

Muhammad Bin Qasim: conquerer of Sindh and Multan
Muhammad Bin Qasim: conquerer of Sindh and MultanMuhammad Bin Qasim: conquerer of Sindh and Multan
Muhammad Bin Qasim: conquerer of Sindh and MultanAbdul Rehman
 
Scrum An: Agile Methodologies in Software Engineering
Scrum An: Agile Methodologies in Software EngineeringScrum An: Agile Methodologies in Software Engineering
Scrum An: Agile Methodologies in Software EngineeringAbdul Rehman
 
Segments of URL and Search Engine Optimization (SEO)
Segments of URL and Search Engine Optimization (SEO)Segments of URL and Search Engine Optimization (SEO)
Segments of URL and Search Engine Optimization (SEO)Abdul Rehman
 
What is Bridge and Types of Bridges in Networking
What is Bridge and Types of Bridges in NetworkingWhat is Bridge and Types of Bridges in Networking
What is Bridge and Types of Bridges in NetworkingAbdul Rehman
 
Database application developer and end users
Database application developer and end usersDatabase application developer and end users
Database application developer and end usersAbdul Rehman
 
Steps of Scientific Paper
Steps of Scientific PaperSteps of Scientific Paper
Steps of Scientific PaperAbdul Rehman
 
Narrative Writing and its types
Narrative Writing and its typesNarrative Writing and its types
Narrative Writing and its typesAbdul Rehman
 
Management information System and its types
Management information System and its typesManagement information System and its types
Management information System and its typesAbdul Rehman
 
Research Methods Qualitative and Quantitative
Research Methods Qualitative and QuantitativeResearch Methods Qualitative and Quantitative
Research Methods Qualitative and QuantitativeAbdul Rehman
 
Types of Technical Report and Writing
Types of Technical Report and WritingTypes of Technical Report and Writing
Types of Technical Report and WritingAbdul Rehman
 
Deletion in linked lists
Deletion in linked listsDeletion in linked lists
Deletion in linked listsAbdul Rehman
 
Computer networking
Computer networkingComputer networking
Computer networkingAbdul Rehman
 
Data communication
Data communicationData communication
Data communicationAbdul Rehman
 

More from Abdul Rehman (13)

Muhammad Bin Qasim: conquerer of Sindh and Multan
Muhammad Bin Qasim: conquerer of Sindh and MultanMuhammad Bin Qasim: conquerer of Sindh and Multan
Muhammad Bin Qasim: conquerer of Sindh and Multan
 
Scrum An: Agile Methodologies in Software Engineering
Scrum An: Agile Methodologies in Software EngineeringScrum An: Agile Methodologies in Software Engineering
Scrum An: Agile Methodologies in Software Engineering
 
Segments of URL and Search Engine Optimization (SEO)
Segments of URL and Search Engine Optimization (SEO)Segments of URL and Search Engine Optimization (SEO)
Segments of URL and Search Engine Optimization (SEO)
 
What is Bridge and Types of Bridges in Networking
What is Bridge and Types of Bridges in NetworkingWhat is Bridge and Types of Bridges in Networking
What is Bridge and Types of Bridges in Networking
 
Database application developer and end users
Database application developer and end usersDatabase application developer and end users
Database application developer and end users
 
Steps of Scientific Paper
Steps of Scientific PaperSteps of Scientific Paper
Steps of Scientific Paper
 
Narrative Writing and its types
Narrative Writing and its typesNarrative Writing and its types
Narrative Writing and its types
 
Management information System and its types
Management information System and its typesManagement information System and its types
Management information System and its types
 
Research Methods Qualitative and Quantitative
Research Methods Qualitative and QuantitativeResearch Methods Qualitative and Quantitative
Research Methods Qualitative and Quantitative
 
Types of Technical Report and Writing
Types of Technical Report and WritingTypes of Technical Report and Writing
Types of Technical Report and Writing
 
Deletion in linked lists
Deletion in linked listsDeletion in linked lists
Deletion in linked lists
 
Computer networking
Computer networkingComputer networking
Computer networking
 
Data communication
Data communicationData communication
Data communication
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Recently uploaded (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

Oracle Database DML DDL and TCL

  • 1. Oracle DDL ,DML & DCL ABDUL REHMAN
  • 2. DDL • SCHEMA – A database schema is the skeleton structure that represents the logical view of the entire database. It defines how the data is organized and how the relations among them are associated. • DATA DEFINATION LANGUAGE – Are collection of those statements which are DIRECTLY related to database Schema • DDL STATEMENTS ARE – CREATE, ALTER, DROP, REPLACE AND TRUNCATE
  • 3. CREATE • Used To Create Objects Like – CREATE TABLE – CREATE FUNCTION – CREATE VIEW – Etc. CREATE TABLE STUDENT ( STDROLLNO number(5) primary key, NAME varchar2(20), CAST varchar2(20) ); STDROLLNO NAME CAST
  • 4. ALTER • Use to Alter Objects like – ALTER TABLE – ALTER USER – ALTER DATABASE ALTER TABLE STUDENT ADD ( ADDRESS NVARCHAR2(50) ); STDROLLNO NAME CASTSTDROLLNO NAME CAST ADDRESS
  • 5. DROP • Use to Drop Objects like – DROP TABLE – DROP USER – DROP FUNCTION – Etc CREATE TABLE EXTRA ( NUM number(5) primary key, NAME nvarchar2(20) ); NUM NAME DROP TABLE EXTRA;
  • 6. REPLACE • Use to Rename table names. RENAME STUDENT TO STUDENTS; STDROLLNO NAME CAST ADDRESS
  • 7. TRUNCATE • Use to truncate (delete all rows) a table.
  • 8. DML • Data manipulation language (DML) • Are the statements query and manipulate data in existing schema objects. – INSERT – UPDATE – DELETE
  • 9. INSERT • Insert into STUDENTS values (3,’Atif’,’Bhatti’,’UK’); • Insert into STUDENTS values (13,’Ahsan’,’Khanzada’,’SK’); STDROLLNO NAME CAST ADDRESS 3 Atif Bhatti UK 13 Ahsan Khanzada SK
  • 10. UPDATE • USED TO MODIFY DATA IN DB – UPDATE STUDENTS SET ADDRESS=‘NAWABSHAH’ WHERE NAME=‘Atif”; STDROLLNO NAME CAST ADDRESS 3 Atif Bhatti UK 13 Ahsan Khanzada SK STDROLLNO NAME CAST ADDRESS 3 Atif Bhatti Nawabshah 13 Ahsan Khanzada SK
  • 11. DELETE • Use the DELETE statement to delete the rows from existing tables which are in your schema or if you have DELETE privilege on them. • DELETE STUDENTS WHERE NAME=‘Ahsan’; STDROLLNO NAME CAST ADDRESS 3 Atif Bhatti Nawabshah 13 Ahsan Khanzada SK
  • 12. DCL • Data Control Language (DCL) Statements – Data Control Language Statements are used to grant privileges on tables, views, procedures to other users or roles. – The DCL statements are • GRANK • REVOKE
  • 13. GRANT • Use to grant privileges to other users or roles. • grant select, update, insert on STUDENTS to David;
  • 14. REVOKE • Use to take back privileges granted to other users and roles. • revoke select, update, insert on emp from David;