Unit 2
Unit 2
SUBJECT: DBMS
B.COM IV
FACULTY: TANYA MATHUR
Relational Database
System
• Relational Database System got introduced in which data get
organized as tables and each record forms a row with many
fields or attributes in it.
• Terms in RDBMS
Table- Relation
Row-Tuples
Columns-Attributes
Domain and Feild
Degree and Cardinality
Example of a Relation
attributes
(or columns)
tuples
(or rows)
CONCEPT OF KEYS
• CANDIDATE KEY
• PRIMARY KEY
• ALTERNATE KEY
• FOREIGN KEY
ER model -- Database
Modeling
• The ER data mode was developed to facilitate database design by
allowing specification of an enterprise schema that represents the
overall logical structure of a database.
• The ER data model employs three basic concepts:
• entity sets,
• relationship sets,
• attributes.
• The ER model also has an associated diagrammatic representation,
the ER diagram, which can express the overall logical structure of a
database graphically.
Entity Sets
• An entity is an object that exists and is distinguishable from
other objects.
• Example: specific person, company, event, plant
• An entity set is a set of entities of the same type that share the
same properties.
• Example: set of all persons, companies, trees, holidays
• An entity is represented by a set of attributes; i.e., descriptive
properties possessed by all members of an entity set.
• Example:
• instructor = (ID, name, salary )
course= (course_id, title, credits)
• A subset of the attributes form a primary key of the entity set;
i.e., uniquely identifying each member of the set.
Representing Entity sets
in ER Diagram
Entity sets can be represented graphically as follows:
• Rectangles represent entity sets.
• Attributes listed inside entity rectangle
• Underline indicates primary key attributes
Relationship Sets
• A relationship is an association among several entities
• A relationship set is a mathematical relation among n 2 entities,
each taken from entity sets.
Example: we define the relationship set advisor to denote the
associations between students and the instructors who act as their
advisors.
Pictorially, we draw a line between related entities.
Relationship Sets
(Cont.)
• For instance, the advisor relationship set between entity sets instructor and
student may have the attribute date which tracks when the student started
being associated with the advisor
Representing
Relationship Sets via ER
Diagrams
Diamonds represent relationship sets.
An attribute can also be associated with a relationship set.
Roles
• Entity sets of a relationship need not be distinct
• Each occurrence of an entity set plays a “role” in the
relationship
• The labels “course_id” and “prereq_id” are called roles.
Degree of a Relationship Set