Session 1
Session 1
Year : 2022
Introduction to Databases
and The Relational Model
Session 1
LEARNING OUTCOME
Systems: A Practical
Approach to Design,
Implementation, and
ISBN: 978-1-292-06118-4,
Chapter 1&4
LEARNING OBJECTIVES
vtraining-msuhandi.blogspot.com
Some common uses of database
systems
Examples of Database Applications
• Renting a video
• Studying at university
jeru.web.id
Purchases from the
supermarket
www.bbc.co.uk
Purchases using your credit card
cards).
indianexpress.com
• To credit accounts when payment
is received.
Booking a holiday at the travel agents
www.parenting-blog.net
Using the local library
• A computerized index to find a book based on its title, or its authors, or its
subject area.
• Able to handle book reservations and give notifications when the book is
available.
• Able to sends reminders if the borrowers have failed to return books by the
due date.
www.bbc.co.uk
Studying at university
the grant
exam results
admissions.
personal details
office
Traditional File-Based System
File-Based Systems
ictlabs-summer-school.sics.se
File-Based Processing
Limitations of File-Based
Approach
• Separation and isolation of data
– Each program maintains its own set of data.
– Users of one program may be unaware of potentially
useful data held by other programs.
• Duplication of data
– Same data is held by different programs.
– Wasted space and potentially different values and/or
different formats for the same item.
www.417solutions.com
Limitations of File-Based
Approach
• Data dependence
– File structure is defined in the program code.
• Arose because:
– Definition of data was embedded in application
programs, rather than being stored separately
and independently.
– No control over access and manipulation of data
beyond that imposed by application programs.
• Result:
– the database and Database Management
System (DBMS).
www.smppgrisatubdl.com
Database
organization.
www.purwadhikapress.com
Database
Management System
(DBMS)
Database Approach
the database.
Student
ClassEnrollment
• Reduce complexity
www.bowelcanceraustralia.org
• Present a consistent, unchanging picture
• Hardware
– Can range from a PC to a network of computers.
• Software
– DBMS, operating system, network software (if necessary) and
also the application programs.
• Data
– Used by the organization and a description of this data called the
schema.
Components of DBMS
Environment
• Procedures
– Instructions and rules that should be applied to the
design and use of the database and DBMS.
• People
pelajar-sejati.blogspot.com
Roles in the Database
Environment
Roles in the Database
Environment
• Data Administrator (DA)
– is responsible for the management of the data resource
including conceptual/logical database design.
• Database Administrator (DBA)
– is responsible for the physical realization of the database.
• Database Designers (Logical and Physical)
– The logical database designer is concerned with identifying
the data and relationships between the data, and the data
constraints.
– The physical database designer decides how the logical
database design is to be physically realized.
Roles in the Database
Environment
• Application Developers/Programmers
– Implement the application programs that provide the
required functionality for the end-users.
• End Users (naive and sophisticated)
– Naïve users are typically unaware of the DBMS. For
example, the checkout assistant at the local supermarket.
– The sophisticated end-user is familiar with the database
structure and DBMS facilities → may use Structured Query
Language (SQL) to perform the operations or write
application programs.
History of Database
Management Systems
History of Database Systems
• First-generation
– Hierarchical and Network
• Second generation
– Relational
• Third generation
– Object-Relational
– Object-Oriented
Hierarchical Data Model
Network Data Model
Relational Data Model
Terminology of Relational Model
Relational Model Terminology
en.wikipedia.org
Relational Model Terminology
Branch Relation/Table
Degree: 4
Cardinality: 5
Staff Relation/Table
Degree: 8
Cardinality: 6
Examples of Attribute Domains
Alternative Terminology
for Relational Model
Mathematical Definition of
Relation
D1 X D2 = {(2, 1), (2, 3), (2, 5), (4, 1), (4, 3), (4, 5)}
• Relation schema
– Named relation defined by a set of attribute and
domain name pairs.
relational schema.
value.
www.cincinnatireview.com
• Superkey
– An attribute, or set of attributes, that uniquely identifies a tuple
within a relation.
– Based on slide slide 40: branchNo, city, postcode are selected as
Superkey of Branch relation
• Candidate Key
– Superkey (K) such that no proper subset is a superkey within the
relation.
– In each tuple of R, values of K uniquely identify that tuple
(uniqueness).
– No proper subset of K has the uniqueness property (irreducibility).
– Based on slide 40, branchNo and postcode are selected as
Candidate Key of Branch relation
Relational Keys
• Primary Key
– Candidate key selected to identify tuples uniquely within relation.
– Based on slide 40: branchNo is primary key of Branch relation,
while staffNo is primary key of Staff relation.
• Alternate Keys
– Candidate keys that are not selected to be primary key.
– Based on slide 40: postcode is Alternate Key of Branch relation
• Foreign Key
– Attribute, or set of attributes, within one relation that matches
candidate key of some (possibly same) relation.
– Based on slide 40, branchNo is foreign key of Staff relation.
Integrity Constraints
Integrity Constraints
• Null
– Represents value for an attribute that is currently unknown
or not applicable for tuple.
– Deals with incomplete or exceptional data.
– Represents the absence of a value and is not the same as
zero or spaces, which are values.
• Entity Integrity
– In a base relation, no attribute of a primary key can be null.
– Based on slide 40: branchNo is primary key of Branch
relation and staffNo is primary key of Staff relation. Both of
them cannot have null value.
Integrity Constraints
•Referential Integrity
– If foreign key exists in a relation, either foreign key value
must match a candidate key value of some tuple in its
home relation or foreign key value must be wholly null.
– Based on slide 40, branchNo is foreign key of Staff
relation. So, its value must refer to branchNo of Branch
relation or null value.
•General Constraints
– Additional rules specified by users or database
administrators that define or constrain some aspect of
the enterprise.
Next Session Preparation
SIS Binus