Lecture 1-Introduction and Relational Model
Lecture 1-Introduction and Relational Model
Introduction to
Database Systems and
Relational Model
Presented by:
Dr. Dina Ezzat
1
What do you
expect to study in
the course?
2
Course Overview
33
Textbook
4
4
Data vs Information
20120023 Student
16 ID: 20120023
IS Age: 16
Department: IS
• Data • Information
• Raw facts, unorganized, • Processed data
unrelated • Data with context
• No context
• Database/Application Program:
➢ A computer program that interacts with the database through the
DBMS.
6
Database System Environment
Users/Programmers
Database
Application Programs/Queries
System
DBMS
Software Software: Query Processing
& Programs
Database
Dictionary Database
(Metadata)
7
Components of a Database System
8
Why we need a Database?
• What kind of data we need to store?
• Examples of DB applications
• Hospital system
• Airline reservation
• Supermarket
• Hotel reservation
• What else?
Decision
Making
Daily operations
• Benefits of a Database?
Database
9
File System: Problem Case
CUSTOMER file MARKETING file SALES file
11
File Systems
• Problems
• Duplication
• Same data may be stored in multiple files.
• Inconsistency
• Same data may be stored by different names in different
formats.
• Rigidity
• Requires customized programming to implement any changes.
• Cannot do ad-hoc queries.
• Implications
• Waste of space.
• Data inaccuracies.
• High overhead of data manipulation and maintenance.
12
File System vs Databases
• Small Systems • Large systems
• Often single user • Multiple users
• Simple structure • Complex structure
• Isolated data • Shared data
• Redundant data • Reduced redundancy
• Relatively cheap • Relatively expensive
• Less secure • More secure
13
What to do with Data?
Data
What else?
14
DBMS Examples
• Oracle
• MySQL
• MS SQL Server
15
DBMS Interfaces
• Menu-based interface
• Forms-based interface
• Query language
16
Classification of DBMS
Based on:
• Data model
➢ Relational, network, hierarchical, object-oriented … etc.
• Number of users
➢ Single user or multi-user.
• Database distribution
➢ Centralized vs. distributed.
17
DBMS Functions
• Data Storage Management
• Data Dictionary
• Data Transformation and Presentation
• Security
• Multi-user Access Control
• Backup and Recovery
• Data Integrity
• Database Access Language
• Database Communication Interface
18
Database Players
• DB Administrator (DBA)
• Access authorization, coordination & monitoring
database usage, problem determination, performance
tuning, etc.
• Designers
• Choose the appropriate structures to represent & store the
data.
• Users
• System analysts & application programmers
19
Database States
• Empty State:
• DB is empty when we first define the DB schema.
• Initial State:
• DB is first populated or loaded with data.
• Current State:
• Snapshot in time.
20
Relational Model
21
Schema vs Instance
• A schema is the way the database designer describes the
structure of the database. It contains the definition of the
data itself with the identification of the relationships
between such data definition.
22
Three-Schema Architecture
• Defines DBMS schema at three levels:
• Internal schema is used to describe physical storage
structures and access paths (e.g indexes).
• Typically uses a physical data model.
24
Data Models
• A database model is a type of model that determines the logical
structure of a database.
• Models:
• Relational Model
• Object-oriented model
• Older models: network model and hierarchical model
25
History of Relational Database Model
• Introduced by Ted Codd in 1970 in a classic paper.
• Ted Codd was an IBM Research Fellow.
• Laid the foundation for database theory.
• Many database concepts and products are based on this
model.
• Most common used database model.
26
Relational Model
• Based on “2-dimensional table” with rows and columns called a relation.
• A relational database is a set of relations.
• Each relation has a unique name in the database.
• Relations are basically tables of data.
• Each row is called a tuple.
• Each row represents a record in the relation.
• Each row (tuple), is a collection of related facts.
• Each column represents an attribute.
• Each attribute/column has a unique name across the relation.
• The degree of the relation is the number of attributes in a relation.
The relation schema of account is:
Account_schema = (acct_id, branch_name, balance)
• Example :
The account ID “A-307”, branch name “Seattle” and balance “275” are all related to each
other.
27
Domain
• A domain D is a set of values, from which one or more attributes take their
values.
• Example
CITY = {London, Paris, Doha, Cairo, Athens, Rome, Dubai, Madrid}
CITY is a set of cities from which the attribute City takes its values.
29
Characteristics of Relations
• Null?
30
Database Schema and Instance
• The Schema (or description) of a Relation:
• Denoted by R(A1, A2, .....An)
• R is the name of the relation
• The attributes of the relation are A1, A2, ..., An
• Example:
CUSTOMER (Cust-id, Cust-name, Address, Phone#)
• Each attribute has a domain or a set of valid values.
• For example, the domain of Cust-id is 6 digit numbers.
• Instance of R is a set of tuples satisfy the schema of R.
• Notes
• Database schema is stable over long period of time.
• Database instance changes constantly as data is inserted or deleted.
31
Company Database Schema
32
Any Questions?
33