UNIT 1
• Introduction
Specialization
• Top-down design process; we designate subgroupings within an entity
set that are distinctive from other entities in the set.
• These subgroupings become lower-level entity sets that have
attributes or participate in relationships that do not apply to the
higher-level entity set.
• Depicted by a triangle component labeled ISA (E.g. customer “is a”
person).
• Attribute inheritance – a lower-level entity set inherits all the
attributes and relationship participation of the higher-level entity set
to which it is linked.
Specialization Example
Generalization
• A bottom-up design process – combine a number of
entity sets that share the same features into a higher-
level entity set.
• Specialization and generalization are simple inversions
of each other; they are represented in an E-R diagram
in the same way.
• The terms specialization and generalization are used
interchangeably.
Generalization example
Specialization and Generalization
(Contd.)
• Can have multiple specializations of an entity set based on
different features.
• E.g. permanent-employee vs. temporary-employee, in
addition to officer vs. secretary vs. teller
• Each particular employee would be
• a member of one of permanent-employee or temporary-employee,
• and also a member of one of officer, secretary, or teller
• The ISA relationship also referred to as superclass - subclass
relationship
Design Constraints on a
Specialization/Generalization
• Constraint on which entities can be members of a given
lower-level entity set.
• condition-defined
• E.g. all customers over 65 years are members of senior-citizen entity
set; senior-citizen ISA person.
• user-defined
• Constraint on whether or not entities may belong to
more than one lower-level entity set within a single
generalization.
• Disjoint
• an entity can belong to only one lower-level entity set
• Noted in E-R diagram by writing disjoint next to the ISA triangle
• Overlapping
• an entity can belong to more than one lower-level entity set
Design Constraints on a
Specialization/Generalization (Contd.)
• Completeness constraint -- specifies whether or not an
entity in the higher-level entity set must belong to at least
one of the lower-level entity sets within a generalization.
• total : an entity must belong to one of the lower-level entity
sets
• partial: an entity need not belong to one of the lower-level
entity sets
Aggregation
Consider the ternary relationship works-on, which we saw earlier
Suppose we want to record managers for tasks performed by an
employee at a branch
Aggregation (Cont.)
• Relationship sets works-on and manages represent overlapping
information
• Every manages relationship corresponds to a works-on relationship
• However, some works-on relationships may not correspond to any
manages relationships
• So we can’t discard the works-on relationship
• Eliminate this redundancy via aggregation
• Treat relationship as an abstract entity
• Allows relationships between relationships
• Abstraction of relationship into new entity
• Without introducing redundancy, the following diagram
represents:
• An employee works on a particular job at a particular branch
• An employee, branch, job combination may have an associated manager
E-R Diagram With Aggregation
E-R Design Decisions
• The use of an attribute or entity set to represent an object.
• Whether a real-world concept is best expressed by an entity set or a
relationship set.
• The use of a ternary relationship versus a pair of binary relationships.
• The use of a strong or weak entity set.
• The use of specialization/generalization – contributes to modularity in
the design.
• The use of aggregation – can treat the aggregate entity set as a single
unit without concern for the details of its internal structure.
E-R Diagram for a Banking
Enterprise
DATABASE LANGUAGES
• SQL statements commonly used in Oracle and MS Acces can be
categorized as-
• Data Definition Languages (DDL)
• Data Manipulation Control (DML)
• Data Control Languages (DCL)
TRUNCATE TABLE table_name;
Truncate
• Syntax:
• TRUNCATE TABLE table_name;
• Example:
• TRUNCATE TABLE CUSTOMERS;
Describe
• Syntax:
• DESCRIBE table_name;
• OR
• DESC table_name;
• Example:
• DESC Users;
DML Commands
• Select
• Update
• Insert
• delete
DCL Commands
• Grant
• Revoke
• Rollback
• Savepoint
Rollback
• It is the transactional command used to undo
transactions that have not already been saved to the
database.
• Syntax:
• ROLLBACK;
Savepoint
• A SAVEPOINT is a point in a transaction in which you can
roll the transaction back to a certain point without
rolling back the entire transaction.
• Syntax:
• SAVEPOINT SAVEPOINT_NAME;
Commit
• COMMIT command is a transactional command used for
saving all the changes made by a particular transaction
in the database management system since the last
commit or rollback.
• Syantax:
• COMMIT;
• Example:
START TRANSACTION; {a set of SQL statements}; COMMIT;
DATABASE USERS
• Naive Users
• Application programmers
• Sophisticated users
• Specialized users
Naive Users
• Unsophisticated users.
• Invoke/use the application program.
• Ex: clerk, teller etc
• Web/ Mobile/ UI Interface.
• Desktop applications
Application programmers
• Computer professionals
• Application development tools.
• Develop user interfaces.
• Rapid Application development tools are used.
• Web/ Mobile interface.
Sophisticated users
• Interact with system
• They know how to use Database query languages
• They know how to use data analysis software.
• Data/ Business analysts
Specialized users
• Specialized DB applications.
• Computer aided design systems
• Knowledge base and expert Systems
• Multimedia data
• Next generation
Reduction of ER Diagram to Tables