SlideShare a Scribd company logo
B.Tech III Sem ‘A’
DATABASE MANAGEMENT
SYSTEMS
Topics Covered
 Database users
 Database Architecture
 DDL
 DML
Student
Std_ID Name
Addr
Sec
DoB
Std_ID Name Addr Sec DoB
189X1A05XY Sree Sanfransisco A 01/01/1999
189X1A05XZ Sri Germany B+ 01/01/2000
ER Model Relational Model
ER Model Vs. Relational Model
Naive / Prgmers / Sophisticated / DBA
Appl.
interface
s
Appl.
programs
Query
tools
Admin
tools
Query Processor
Object
code
Compiler
DML
Queries
DDL
Interpreter
Query Evaluation Engine
Storage Manager
Buffer
Manager
File
Manager
Authorization &
integrity manager
Transaction
Manager
Data Indice
s
Data
Dictionar
y
Disk Storage
Users
DDL Commands
DDL:
Data Definition
Language
 CREATE
 ALTER
 DROP
 RENAME
DML:
Data Manipulation Language
 INSERT
 UPDATE
 DELETE
 SELECT
DCL:
Data Control Language
 GRANT
 REVOKE
 COMMIT (TCL)
 ROLLBACK (TCL)
DDL: Create
CREATE TABLE
CUSTOMER1(
ID Number(2),
NAME NVARCHAR2 (20),
AGE INT,
ADDRESS NVARCHAR2
(30) ,
SALARY DECIMAL (10, 2)
create table cust_temp as
select id, name from
customer1;
CREATE TABLE STUDENT2
(
ID INT NOT NULL,
NAME VARCHAR(20) NOT
NULL,
AGE INT NOT NULL,
DDL: Alter
 ALTER TABLE table_name ADD column_name
datatype;
 ALTER TABLE table_name DROP COLUMN
column_name;
 ALTER TABLE table_name MODIFY COLUMN
column_name datatype;
 ALTER TABLE table_name MODIFY column_name
datatype NOT NULL;
DDL Command: DROP &
Rename
 Drop table student;
 Rename student1 to student2;
 TRUNCATE TABLE customer1;
DML: Data Manipulation Language
 INSERT
 UPDATE
 DELETE
 SELECT
DML Example: Insert
insert into customer1values(90, 'Codd',60,'San Fransisco',
150000);
insert into customer1 values(&id,
'&name',&age,'&address',&salary);
SELECT * FROM EMPLOYEE
UPDATE Customer1 set ID=18, WHERE Name='henry
korth';DELETE FROM Customer1 WHERE Name='Henry Korth' AND
age=60;
Today’s Topics
 DCL
 Entity Relationship Model
 Basic concepts
 Cardinality of Relationship
 ER Diagram Notations
 ER Diagrams: Examples
DCL: Data Control Language
 GRANT : used to grant or give the privileges.
 REVOKE : used to avoid or object the privileges.
 COMMIT: used to save the data permanently.
 ROLL BACK : Used to revert changes in the
transactions since the last commit or rollback
command was issued
DCL: Commit
DELETE FROM
CUSTOMERS
WHERE AGE = 25;
SQL> COMMIT;
Rollback
 ROLLBACK command is the transactional
command used to undo transactions that have
not already been saved to the database.
 This command can only be used to undo
transactions since the last COMMIT or
ROLLBACK command was issued.
 DELETE FROM CUSTOMERS WHERE AGE =
25;
DCL : Grant & Revoke
create user korth identified by henry
 Connect as system/ora10g
GRANT SELECT, INSERT, UPDATE, DELETE
ON Emp_Det TO korth;
REVOKE DELETE ON Emp_details FROM
Entity Relationship Model
 The ER data model facilitates database design
by allowing specification of an enterprise
schema that represents the overall logical
structure of a database.
 The E-R data model employs three basic
concepts: entity sets, relationship sets, and
attributes
Entity Sets
 Entity: Real-world object distinguishable from other
objects. An entity is described (in DB) using a
set of attributes.
 Entity Set: A collection of similar entities. E.g., all
employees.
 All entities in an entity set have the same set of attributes.
 Each entity set has a key.
 Each attribute has a domain.
Entity Sets
Relationship Sets
 Relationship: Association among two or more
entities.
 A relationship set is a mathematical relation
among n  2 entities, each taken from entity sets
{(e1, e2, … en) | e1  E1, e2  E2, …, en 
En}
where (e1, e2, …, en) is a relationship
Relationship: Depositor
Relationship: Borrower
Attributes
 An entity is represented by a set of
attributes, that is descriptive properties
possessed by all members of an entity
set.Example:
customer = (customer_id, customer_name, customer_street,
customer_city )
loan = (loan_number, amount )
Attribute types
 Simple : Attribute is simple, if its value can not be divided into subparts.
For example Std_ID, GPA.
 Composite : Attribute is composite, if its value can be divided into
subparts. Ex: Name: First Name; Middle Name; Last Name
Address: H.No; street; city; pincode
 Single-valued : Attribute is a single-valued, if it has only one value for a
particular entity
 Multivalued : Attribute is multivalued, if it has a set of values for a
particular entity. Ex: Phone number
 Derived: Attribute is a derived, if its value can be derived from the values
of other related attributes or entities. Ex: Age, given dateofbirth
DBMS Notes: DDL DML DCL
ER Diagram Notations
 Rectangles represent entity sets
 Ellipses represent attributes
 Diamonds represent relationship sets
 Lines link attributes to entity sets and link entity
sets to relationships sets
Continued…
 ER Diagram Notations
 ER Diagram Examples

More Related Content

PPTX
Group By, Having Clause and Order By clause
PPT
Aggregate functions
PPTX
PPTX
database language ppt.pptx
PPTX
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
PPTX
Relational model
PDF
Relational algebra in dbms
Group By, Having Clause and Order By clause
Aggregate functions
database language ppt.pptx
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
Relational model
Relational algebra in dbms

What's hot (20)

PPTX
PPTX
DATABASE CONSTRAINTS
PPTX
Integrity Constraints
PPTX
Nested queries in database
PPTX
SQL Joins.pptx
PPT
Dbms relational model
PDF
View & index in SQL
PPTX
Functional dependencies in Database Management System
PDF
SQL Overview
PPTX
joins in database
PPTX
Basic Concept Of Database Management System (DBMS) [Presentation Slide]
PDF
Chapter 4 Structured Query Language
PPT
Week 3 Classification of Database Management Systems & Data Modeling
PPTX
SQL Basics
PPT
Data independence
PPT
Joins in SQL
PPTX
SQL JOIN
PPTX
Normalization in DBMS
PPTX
SQL commands
PPTX
Database management functions
DATABASE CONSTRAINTS
Integrity Constraints
Nested queries in database
SQL Joins.pptx
Dbms relational model
View & index in SQL
Functional dependencies in Database Management System
SQL Overview
joins in database
Basic Concept Of Database Management System (DBMS) [Presentation Slide]
Chapter 4 Structured Query Language
Week 3 Classification of Database Management Systems & Data Modeling
SQL Basics
Data independence
Joins in SQL
SQL JOIN
Normalization in DBMS
SQL commands
Database management functions
Ad

Similar to DBMS Notes: DDL DML DCL (20)

PPTX
Dbms ER Model
PPTX
Normalization in database of database management system .pptx
PPTX
Database Management System(UNIT 1)
PPTX
Database Management System(UNIT 1)
PPTX
PPT
RDBMS.ppt What is RDBMS RDBMS stands for Relational Database Management System.
PPTX
Day 1 SQL.pptx
PPTX
SQL.pptx
PPTX
Chapter 1 introduction to sql server
PDF
Unit_2.pdf
DOC
introduction of database in DBMS
PDF
DBMS Unit 1 nice content please download it
PDF
PPTX
Introduction of Database Design and Development
PPTX
Lecture 3 note.pptx
PPTX
Chapter 1 introduction to sql server
PPT
Relational Database Management Systems Concepts
PPTX
dbms-introduction and the explanation of
PDF
Bca examination 2015 dbms
PPTX
Relation DB.pptx a powerpoint presentation
Dbms ER Model
Normalization in database of database management system .pptx
Database Management System(UNIT 1)
Database Management System(UNIT 1)
RDBMS.ppt What is RDBMS RDBMS stands for Relational Database Management System.
Day 1 SQL.pptx
SQL.pptx
Chapter 1 introduction to sql server
Unit_2.pdf
introduction of database in DBMS
DBMS Unit 1 nice content please download it
Introduction of Database Design and Development
Lecture 3 note.pptx
Chapter 1 introduction to sql server
Relational Database Management Systems Concepts
dbms-introduction and the explanation of
Bca examination 2015 dbms
Relation DB.pptx a powerpoint presentation
Ad

More from Sreedhar Chowdam (20)

PDF
DBMS Nested & Sub Queries Set operations
PDF
DBMS Notes selection projection aggregate
PDF
Database management systems Lecture Notes
PPT
Advanced Data Structures & Algorithm Analysi
PDF
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
PPTX
Design and Analysis of Algorithms Lecture Notes
PDF
Design and Analysis of Algorithms (Knapsack Problem)
PDF
DCCN Network Layer congestion control TCP
PDF
Data Communication and Computer Networks
PDF
DCCN Unit 1.pdf
PDF
Data Communication & Computer Networks
PDF
PPS Notes Unit 5.pdf
PDF
PPS Arrays Matrix operations
PDF
Programming for Problem Solving
PDF
Big Data Analytics Part2
PDF
Python Programming: Lists, Modules, Exceptions
PDF
Python Programming by Dr. C. Sreedhar.pdf
PDF
Python Programming Strings
PDF
Python Programming
PDF
Python Programming
DBMS Nested & Sub Queries Set operations
DBMS Notes selection projection aggregate
Database management systems Lecture Notes
Advanced Data Structures & Algorithm Analysi
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms Lecture Notes
Design and Analysis of Algorithms (Knapsack Problem)
DCCN Network Layer congestion control TCP
Data Communication and Computer Networks
DCCN Unit 1.pdf
Data Communication & Computer Networks
PPS Notes Unit 5.pdf
PPS Arrays Matrix operations
Programming for Problem Solving
Big Data Analytics Part2
Python Programming: Lists, Modules, Exceptions
Python Programming by Dr. C. Sreedhar.pdf
Python Programming Strings
Python Programming
Python Programming

Recently uploaded (20)

PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPT
Mechanical Engineering MATERIALS Selection
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Welding lecture in detail for understanding
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
Sustainable Sites - Green Building Construction
PPTX
web development for engineering and engineering
PPTX
CH1 Production IntroductoryConcepts.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Embodied AI: Ushering in the Next Era of Intelligent Systems
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
bas. eng. economics group 4 presentation 1.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Mechanical Engineering MATERIALS Selection
Automation-in-Manufacturing-Chapter-Introduction.pdf
Welding lecture in detail for understanding
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Digital Logic Computer Design lecture notes
Sustainable Sites - Green Building Construction
web development for engineering and engineering
CH1 Production IntroductoryConcepts.pptx

DBMS Notes: DDL DML DCL

  • 1. B.Tech III Sem ‘A’ DATABASE MANAGEMENT SYSTEMS
  • 2. Topics Covered  Database users  Database Architecture  DDL  DML
  • 3. Student Std_ID Name Addr Sec DoB Std_ID Name Addr Sec DoB 189X1A05XY Sree Sanfransisco A 01/01/1999 189X1A05XZ Sri Germany B+ 01/01/2000 ER Model Relational Model ER Model Vs. Relational Model
  • 4. Naive / Prgmers / Sophisticated / DBA Appl. interface s Appl. programs Query tools Admin tools Query Processor Object code Compiler DML Queries DDL Interpreter Query Evaluation Engine Storage Manager Buffer Manager File Manager Authorization & integrity manager Transaction Manager Data Indice s Data Dictionar y Disk Storage Users
  • 5. DDL Commands DDL: Data Definition Language  CREATE  ALTER  DROP  RENAME DML: Data Manipulation Language  INSERT  UPDATE  DELETE  SELECT DCL: Data Control Language  GRANT  REVOKE  COMMIT (TCL)  ROLLBACK (TCL)
  • 6. DDL: Create CREATE TABLE CUSTOMER1( ID Number(2), NAME NVARCHAR2 (20), AGE INT, ADDRESS NVARCHAR2 (30) , SALARY DECIMAL (10, 2) create table cust_temp as select id, name from customer1; CREATE TABLE STUDENT2 ( ID INT NOT NULL, NAME VARCHAR(20) NOT NULL, AGE INT NOT NULL,
  • 7. DDL: Alter  ALTER TABLE table_name ADD column_name datatype;  ALTER TABLE table_name DROP COLUMN column_name;  ALTER TABLE table_name MODIFY COLUMN column_name datatype;  ALTER TABLE table_name MODIFY column_name datatype NOT NULL;
  • 8. DDL Command: DROP & Rename  Drop table student;  Rename student1 to student2;  TRUNCATE TABLE customer1;
  • 9. DML: Data Manipulation Language  INSERT  UPDATE  DELETE  SELECT
  • 10. DML Example: Insert insert into customer1values(90, 'Codd',60,'San Fransisco', 150000); insert into customer1 values(&id, '&name',&age,'&address',&salary); SELECT * FROM EMPLOYEE UPDATE Customer1 set ID=18, WHERE Name='henry korth';DELETE FROM Customer1 WHERE Name='Henry Korth' AND age=60;
  • 11. Today’s Topics  DCL  Entity Relationship Model  Basic concepts  Cardinality of Relationship  ER Diagram Notations  ER Diagrams: Examples
  • 12. DCL: Data Control Language  GRANT : used to grant or give the privileges.  REVOKE : used to avoid or object the privileges.  COMMIT: used to save the data permanently.  ROLL BACK : Used to revert changes in the transactions since the last commit or rollback command was issued
  • 13. DCL: Commit DELETE FROM CUSTOMERS WHERE AGE = 25; SQL> COMMIT;
  • 14. Rollback  ROLLBACK command is the transactional command used to undo transactions that have not already been saved to the database.  This command can only be used to undo transactions since the last COMMIT or ROLLBACK command was issued.  DELETE FROM CUSTOMERS WHERE AGE = 25;
  • 15. DCL : Grant & Revoke create user korth identified by henry  Connect as system/ora10g GRANT SELECT, INSERT, UPDATE, DELETE ON Emp_Det TO korth; REVOKE DELETE ON Emp_details FROM
  • 16. Entity Relationship Model  The ER data model facilitates database design by allowing specification of an enterprise schema that represents the overall logical structure of a database.  The E-R data model employs three basic concepts: entity sets, relationship sets, and attributes
  • 17. Entity Sets  Entity: Real-world object distinguishable from other objects. An entity is described (in DB) using a set of attributes.  Entity Set: A collection of similar entities. E.g., all employees.  All entities in an entity set have the same set of attributes.  Each entity set has a key.  Each attribute has a domain.
  • 19. Relationship Sets  Relationship: Association among two or more entities.  A relationship set is a mathematical relation among n  2 entities, each taken from entity sets {(e1, e2, … en) | e1  E1, e2  E2, …, en  En} where (e1, e2, …, en) is a relationship
  • 22. Attributes  An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set.Example: customer = (customer_id, customer_name, customer_street, customer_city ) loan = (loan_number, amount )
  • 23. Attribute types  Simple : Attribute is simple, if its value can not be divided into subparts. For example Std_ID, GPA.  Composite : Attribute is composite, if its value can be divided into subparts. Ex: Name: First Name; Middle Name; Last Name Address: H.No; street; city; pincode  Single-valued : Attribute is a single-valued, if it has only one value for a particular entity  Multivalued : Attribute is multivalued, if it has a set of values for a particular entity. Ex: Phone number  Derived: Attribute is a derived, if its value can be derived from the values of other related attributes or entities. Ex: Age, given dateofbirth
  • 25. ER Diagram Notations  Rectangles represent entity sets  Ellipses represent attributes  Diamonds represent relationship sets  Lines link attributes to entity sets and link entity sets to relationships sets
  • 26. Continued…  ER Diagram Notations  ER Diagram Examples