Lilac Safadi Database Systems 1
Chapter 1
Database ConceptsDatabase Concepts
Chapter 1 &2 in Textbook
Lilac Safadi Database Systems 2
Database ConceptsDatabase ConceptsData is a meaningless static value. What does 3421 means?
Information is the data you process in a manner that makes it meaningful. Information can be provided only if proper data exists.
A database (DB) is a collection of related persistent data. Can be generated & maintained manually or automatically
Data is what you store in database. Information is what you retrieve from a database.
A database application is a collection of data and the programs that allow the manipulation of these data to meet the information needs of an enterprise
Lilac Safadi Database Systems 3
Database Application: ExamplesDatabase Application: Examples
• The e-shop around the corner
• KSU Library
• Saudia Airline Reservations
• KSU University
Lilac Safadi Database Systems 4
Database ConceptsDatabase Concepts
A database application is usually implemented using a Database Management System (DBMS)
Database System (DBS) is DB + Software (DBMS + Application program) (TO BE CONTINUED ..)
Lilac Safadi Database Systems 5
DBS EnvironmentDBS Environment
DatabaseMeta-Data
Data Access
Query Process
Application Programs
DBMS
DBS
Lilac Safadi Database Systems 6
File-Based Systems (FBS)File-Based Systems (FBS)
FBS is a collection of application programs that perform tasks where each program defines and manages its own data.
DataEntry
Filehandling
File DefUser 1
Application Program 1 File1
DataEntry
Filehandling
File DefUser 2
Application Program 2 File 2
Lilac Safadi Database Systems 7
File-Based Systems (FBS)File-Based Systems (FBS)Major Disadvantages of FBS:
• Data Redundancy & Inconsistency• Data Isolation• Data Dependence• Incompatible File Format• Fixed Queries/Proliferation of application
programs
Lilac Safadi Database Systems 8
File-Based Systems (FBS)File-Based Systems (FBS)
The limitations of the FBS approach attributed to two factors:
• The definition of data is embedded in the application programs
• There is no control over the access & manipulation of data beyond the imposed by the application program
Lilac Safadi Database Systems 9
DataBased Systems (DBS)DataBased Systems (DBS)
DBS is a single large repository of data, defined once & used by many application programs.
User 1
Application Program 1
DatabaseUser 2
Application Program 2
DataEntry
DataEntry
DBMS
Lilac Safadi Database Systems 10
Database Systems (DBS) Database Systems (DBS) Ref 1Ref 1
Major Characteristics of DBS:
• Self-Describing nature • Program-Data Independence• Sharing of Data & Multi-user Transactions
(Concurrency Control)• Support of Multiple Views of the Data
Lilac Safadi Database Systems 11
Database Systems (DBS)Database Systems (DBS)
Staff_No FName LName Age Salary Bno
Staff_No FName LName Age Salary Staff_No LName Bno
View 1 View 2
DBS Support of Multiple Views of Data
Lilac Safadi Database Systems 12
Database Systems (DBS)Database Systems (DBS)
Disadvantages of DBS:
• Complexity• Size• Cost (DBMS,Hardware, Staff, Training)• Performance• Higher impact of a failure
Lilac Safadi Database Systems 13
Database Management SystemDatabase Management System(DBMS)(DBMS)
A DBMS is a collection of software that facilitates the implementation and management of database applications
Lilac Safadi Database Systems 14
Database Management System Database Management System (DBMS)(DBMS)
DBMS facilitates the following:
• Creating and Defining a DB• Construct and Store a DB• Manipulate a DB (query & update the DB)• Control access to data
Lilac Safadi Database Systems 15
Database Management SystemDatabase Management System
Major Relational DBMS vendors/products
• Paradox by Corel• dBase, Clipper• FoxPro, Access & SQL Server by MS • MySQL• DB2 by IBM • Oracle, Sybase, Informix
Lilac Safadi Database Systems 16
DBS EnvironmentDBS Environment
DBMSApp
Program
DB
UserRequirement
Procedure
DBA
Naïve End User
Applicationprogrammer
DB Designer System Analyst
Sophisticated End User H/W
Design
Communicate
Manage
Write Write
Program
Use
Use
Lilac Safadi Database Systems 17
Database PeopleDatabase People• Database Administrator (DBA): administrates the DB, DBMS & related
software
• Database Designer: Identify the data & choose the appropriate structure to represent &store the data
• Database user: Queries/modifies data- Naïve users: invoke one of the permanent application programs that have been written previously
- Sophisticated users: form requests in a database query language
Lilac Safadi Database Systems 18
Database PeopleDatabase People
• System Analyst: determine the requirements of end users & develop system specifications
• Application Programmer: implement system specifications
• DBMS designer & Implementers
• Tool Developer
• Operators & Maintenance Personnel
Lilac Safadi Database Systems 19
Three-Schema Architecture
Lilac Safadi Database Systems 20
Three-Schema Architecture
Database
InternalDescription
ConceptualDescription
View 2 View nView 1
User 1 User 2 User n
ExternalLevel
ConceptualLevel
InternalLevel
Lilac Safadi Database Systems 21
Three-Schema Architecture
•Internal level: describes how data is stored. The way perceived by the DBMS & OS.
•Conceptual level: describes what data stored in DB, and the relationships among the data. The way perceived by the DBA & programmers.
•External level: describes the part of the DB that user is interested in. The way perceived by the end users.
Lilac Safadi Database Systems 22
Three-Schema Architecture
Emp_No FName LName Dept_No Emp_No LName Salary
View 1 View 2
InternalLevel
ConceptualLevel
EMPLOYEEEmp_No CHAR(6)FName CHAR(15)LName CHAR(15)Dept_No CHAR(3)Salary NUMBER(5)
PREFIX TYPE=BYTE(6),OFFSET=0EMP# TYPE=BYTE(6),OFFSET=6, INDEX=EMPXLNM TYPE=BYTE(15),OFFSET=12FNM TYPE=BYTE(15),OFFSET=27DPT# TYPE=BYTE(4),OFFSET=42PAY TYPE=FULLWORD,OFFSET=46
ExternalLevel
Lilac Safadi Database Systems 23
Schemas & Instances
Schema is the description of the DB.It rarely changes.
Instance is the actual content of the DB at a particular point in time. Data is actual "instance" of DB, changes rapidly.
The concepts of Schema & Instances corresponds to Types & Values in programming languages, respectively
Lilac Safadi Database Systems 24
Mapping
Mapping is the process of transforming requests and results between the Internal, Conceptual & External levels.
Two types of mapping:
- External / Conceptual mapping
-Conceptual / Internal mapping
Lilac Safadi Database Systems 25
Data Independence
Data Independence is the ability to modify a schema definition in one level without affecting a schema definition in the next higher level.
Two levels of data independence:
– Logical data independence
– Physical data independence
Lilac Safadi Database Systems 26
Data Independence
InternalSchema
ConceptualSchema
ExternalSchema
ExternalSchema
ExternalSchema
External/ConceptualMapping
Conceptual/InternalMapping
Logical data Independence
Physical data Independence
Lilac Safadi Database Systems 27
Data Definition Language (DDL)
DDL is a descriptive language for defining the database schema
DDL compiler generates meta-data stored in a the data dictionary
Lilac Safadi Database Systems 28
Data Manipulation Language (DML)
Two classes of languages
– Procedural: user specifies what data is required and how to get those data
– Nonprocedural: user specifies what data is required without specifying how to get those data (e.g. SQL)
DML is a language for retrieving and updating (insert, delete, & modify) the data in the DB
Lilac Safadi Database Systems 29
Database Languages
DBMS have a facility for embedding DDL & DML (sub-languages) in a High-Level Language (COBOL,PASCAL, C), which in this case is considered a host language.
DBMSCall to DB
C,C++,Lisp,..
Local Vars(memory)
ApplicationProgram
Lilac Safadi Database Systems 30
Data Models
Data Model is a set of concepts for describing the structure of a DB
Categories of data models:
- Object-based conceptual model
- Record-based logical model
- Physical model
Lilac Safadi Database Systems 31
Data Models
Conceptual model is the construction of an enterprise’s information that is independent of implementation details.
Logical model is the logical description of an enterprise’s information with high level description of the implementation.
Lilac Safadi Database Systems 32
Data Models
Physical model
Logicalmodel
Conceptualmodel
Hardware dependentSoftware dependent
Hardware independentSoftware dependent
Hardware independentSoftware independent
Lilac Safadi Database Systems 33
Data ModelsObject-based conceptual model
– Entity-Relationship
– Object-Oriented
– Semantic
– Functional
- Binary
Record-based logical models
– Relational model
– Network model
– Hierarchical model
Lilac Safadi Database Systems 34
Data Models
Staff_No LName Salary Brn_No Brn_No Street Tel_No
St1 Name1 7000 1St2 Name2 4000 1St3 Name3 6500 2St4 Name4 3000 3
1 Olayaa 46300002 Malaz 47800003 Rawda 2310000
St1 Name1 7000 Olayaa 4630000
St2 Name2 4000
St3 Name3 6500
St4 Name4 3000
Malaz 4780000
Rawda 2310000
RelationalModel
NetworkModel
Lilac Safadi Database Systems 35
Data Models
St3 Name3 6500
HierarchicalModel
St1 Name1 7000 St2 Name2 4000
St4 Name4 3000
Olayaa 4630000Malaz 4780000 Rawda 2310000
Lilac Safadi Database Systems 36
Summary of DB Concepts (1)
• Database (DB)
• Database Application
• Database Management System (DBMS)
• Database System (DBS) - Centralized approach
• File-Based System(FBS) - Decentralized approach
• Program-data dependence & independence
• Meta-data & data dictionary
• Concurrency Control
Lilac Safadi Database Systems 37
Summary of DB Concepts (2)• Three-schema Architecture (internal, conceptual, & external levels)
• Schemas &Instances
• Mapping (external/conceptual, conceptual/internal)
• Data Independence (logical & physical)
• Data Definition Language (DDL)
• Data Manipulation Language (DML)
• Query language& host language
• Conceptual model,Logical model,&Physical model
• Data model (Entity-Relationship, Object-Oriented, Relational)