B.Tech III Sem ‘A’
DATABASE MANAGEMENT
SYSTEMS
16 Jul 2019
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.
 ROLLBACK : 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
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
Entity Relationship Model
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, Grade.
 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. PassportNo.
 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 can be derived based on dob
ER Diagram Notations
________
_
Key
attribute
Derived
attribute
E-R Diagrams
Composite
Attributes
Multivalued
attributes
Derived Attribute
Relationship
Recursive
relationship
Cardinality Relationships
 The degree of a relationship = the number of
entity sets that participate in the relationship
 Mapping cardinality of a relationship
 1 –1
 1 – many
 many – 1
 Many-many
Mapping Cardinalities
One to one One to many
One-to-one: An entity in A is associated with at most one entity in B, and an
entity in B is associated with at most one entity in A
One-to-many: An entity in A is associated with any number in B. An entity in
B is associated with at most one entity in A
Mapping Cardinalities
Many to one Many to many
Many-to-one: An entity in A is associated with at most one entity in B. An entity
in B is associated with any number in A
Many-to-many: Entities in A and B are associated with any number from each other.
Supporting Slides
Dbms ER Model
Dbms ER Model
Dbms ER Model

Dbms ER Model

  • 1.
    B.Tech III Sem‘A’ DATABASE MANAGEMENT SYSTEMS 16 Jul 2019
  • 2.
    DCL: Data ControlLanguage  GRANT : used to grant or give the privileges.  REVOKE : used to avoid or object the privileges.  COMMIT: used to save the data permanently.  ROLLBACK : Used to revert changes in the transactions since the last commit or rollback command was issued
  • 3.
  • 4.
    Rollback  ROLLBACK commandis 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;
  • 5.
    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
  • 6.
    Student Std_ID Name Addr Sec DoB Std_ID NameAddr Sec DoB 189X1A05XY Sree Sanfransisco A 01/01/1999 189X1A05XZ Sri Germany B+ 01/01/2000 ER Model Relational Model Entity Relationship Model represents the overall logical structure of a database. The E-R data model employs three basic concepts: entity sets, relationship sets, and attributes
  • 7.
    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.
  • 8.
  • 9.
    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
  • 10.
  • 11.
  • 12.
    Attributes  An entityis 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 )
  • 13.
    Attribute types  Simple: Attribute is simple, if its value can not be divided into subparts. For example Std_ID, Grade.  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. PassportNo.  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 can be derived based on dob
  • 15.
  • 16.
  • 17.
  • 19.
    Cardinality Relationships  Thedegree of a relationship = the number of entity sets that participate in the relationship  Mapping cardinality of a relationship  1 –1  1 – many  many – 1  Many-many
  • 20.
    Mapping Cardinalities One toone One to many One-to-one: An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A One-to-many: An entity in A is associated with any number in B. An entity in B is associated with at most one entity in A
  • 21.
    Mapping Cardinalities Many toone Many to many Many-to-one: An entity in A is associated with at most one entity in B. An entity in B is associated with any number in A Many-to-many: Entities in A and B are associated with any number from each other.
  • 22.