Professional Documents
Culture Documents
Session 1 - Foundation of DBMS - A Review
Session 1 - Foundation of DBMS - A Review
November 9, 2013
Course Outline
Relational Data Model
Relational Calculus
Exercises
Entity – relationship diagram
3 easy step
Transformation
Exercise/Activity
Assignment
Machine Problem
Relational Data Model
enables programmer to view logically rather than physically
Tables and Their Characteristics
Table: two-dimensional structure composed of rows and
columns
also known as relation
Tuples/rows/records/instance
Attributes/columns/field names
Tables and Their Characteristics (cont)
Keys
Consists of one or more attributes that determine other
attributes
Primary keys
attribute (or a combination of attributes) that uniquely
identifies any given entity (row)
entity integrity constraints
Foreign key (FK)
An attribute whose values match primary key values in the
related table
referential integrity constraint
Integrity Rules
Relational Database Operators
Relational algebra
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Domains
Attributes have domain
Domain is attribute’s set of possible values
Attributes may share a domain
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Composite and Simple Attributes
Composite attribute can be subdivided
Simple attribute cannot be subdivided
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Derived Attributes
Attribute whose value may be calculated (derived) from
other attributes
Need not be physically stored within database
Can be derived by using an algorithm
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Derived Attributes (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Relationships
Association between entities
Participants are entities that participate in a relationship
Relationships between entities always operate in both directions
Relationship can be classified as 1:M
Relationship classification is difficult to establish if know only one
side of the relationship
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Relationship Participation (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Relationship Participation (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Relationship Participation (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel
Exercise 1
Consider the following information about a university database:
Each student has an id (sid), a name (sname), a major study
direction (major) and an age (age).
Each course has a name (cname), a time at which the course
takes place (meets_at) and a room in which the course takes
place (room).
Each faculty has an id (fid) and a name (fname).
Students can be enrolled in several courses and for each course
there exists at least one student who is enrolled in that course.
Each course belongs to one faculty and for each faculty exists at
least one course which belongs to this faculty.
Exercise 2
A company database needs to store information about employees
(identified by a social security number (ssn), with salary and phone as
attributes) and departments (identified by dno, with dname and budget
as attributes). Employees work in departments and each department
is managed by one employee.