You are on page 1of 18

EE-334

DATABASE SYSTEMS
Background
Week 1

The University of Faisalabad


FSD
DATABASE ?

• What is Database ?
 A database is an ordered collection of related data
that is built for a specific purpose.
 A database may be organized as a collection of
multiple tables, where a table represents a real
world element or entity.
 Each table has several different fields that
represent the characteristic features of the entity.

Lectures Slides 2
The University of Faisalabad, FSD
What is Database Management System?
 A DBMS is a collection of programs that enables
creation and maintenance of a database.
 DBMS is available as a software package that
facilitates the following operations in a database:
 Definition: includes description of the structure of a DB
 Construction: involves actual storing of the data in any
storage medium
 Manipulation: retrieving information from the database,
updating the database and generating reports
 Sharing of data: facilitates data to be accessed by
different users or programs
Lectures Slides 3
The University of Faisalabad, FSD
Examples of DBMS Application

• Automatic Teller Machines


• Train Reservation System
• Employee Management System
• Student Information System

Lectures Slides 4
The University of Faisalabad, FSD
Examples of DBMS Packages

• MySQL
• Oracle
• SQL Server
• SQL Lite
• dBASE
• FoxPro
• Postgre SQL, etc.

Lectures Slides 5
The University of Faisalabad, FSD
What is Database Schemas?

• A database schema is a description of the database


which is specified during database design and
subject to infrequent alterations.

• It defines the organization of the data, the


relationships among them, and the constraints
associated with them.

Lectures Slides 6
The University of Faisalabad, FSD
Database Schema

• Databases are often represented through the three-


schema architecture or ANSI-SPARC architecture.

• The goal of this architecture is to separate the user


application from the physical database.

• The ANSI / SPARC architecture is claimed to be based on


the data organization.

Lectures Slides 7
The University of Faisalabad, FSD
ANSI / SPARC ARCHITECTURE
• internal view: It describes the physical structure, details of
internal storage and access paths for the database, that of the
system or machine
• conceptual view: It describes the structure of the whole
database while hiding the details of physical storage of data that of
the enterprise.
• external view: It describes the portion of a database relevant to
a particular user or a group of users while hiding the rest of
database. which is that of the user, who might be a programmer;

For each of these views, an appropriate schema definition is


required.

Lectures Slides 8
The University of Faisalabad, FSD
DBMS STANDARDIZATION
ANSI / SPARC ARCHITECTURE

The University of Faisalabad, FSD 9


DBMS STANDARDIZATION
ANSI / SPARC ARCHITECTURE
• At the lowest level of the architecture is the internal view,
which deals with the physical definition and organization
of data.

• At the other extreme is the external view, which is


concerned with how users view the database.

• Between these two ends is the conceptual schema, which


is an abstract definition of the database. It is the “real
world” view of the enterprise being modeled in the
database.
The University of Faisalabad, FSD 10
Relation Schemes
EMP
ENO ENAME TITLE SAL PNO RESP DUR

PROJ
PNO PNAME BUDGET

EMP(ENO, ENAME, TITLE, SAL, PNO, RESP, DUR)


PROJ (PNO, PNAME, BUDGET)

• Underlined attributes are relation keys (tuple


identifiers).
• Tabular form
Example Relation Instances
Repetition Anomaly
• The NAME,TITLE, SAL attribute values are repeated for
each project that the employee is involved in.
– Waste of space
– Complicates updates
EMP

ENO ENAME TITLE SAL PNO RESP DUR

E1 J. Doe Elect. Eng. 40000 P1 Manager 12


E2 M. Smith Analyst 34000 P1 Analyst 24

E2 M. Smith Analyst 34000 P2 Analyst 6


E3 A. Lee Mech. Eng. 27000 P3 Consultant 10
E3 A. Lee Mech. Eng. 27000 P4 Engineer 48
E4 J. Miller Programmer 24000 P2 Programmer 18
E5 B. Casey Syst. Anal. 34000 P2 Manager 24

E6 L. Chu Elect. Eng. 40000 P4 Manager 48

E7 R. Davis Mech. Eng. 27000 P3 Engineer 36

E8 J. Jones Syst. Anal. 34000 P3 Manager 40


Update Anomaly
• If any attribute of project (say SAL of an
employee) is updated, multiple tuples have to
be updated to reflect the change.
EMP

ENO ENAME TITLE SAL PNO RESP DUR

E1 J. Doe Elect. Eng. 40000 P1 Manager 12


E2 M. Smith Analyst 34000 P1 Analyst 24

E2 M. Smith Analyst 34000 P2 Analyst 6


E3 A. Lee Mech. Eng. 27000 P3 Consultant 10
E3 A. Lee Mech. Eng. 27000 P4 Engineer 48
E4 J. Miller Programmer 24000 P2 Programmer 18

E5 B. Casey Syst. Anal. 34000 P2 Manager 24

E6 L. Chu Elect. Eng. 40000 P4 Manager 48

E7 R. Davis Mech. Eng. 27000 P3 Engineer 36

E8 J. Jones Syst. Anal. 34000 P3 Manager 40


Insertion Anomaly
• It may not be possible to store information about
a new project until an employee is assigned to it.
EMP

ENO ENAME TITLE SAL PNO RESP DUR

E1 J. Doe Elect. Eng. 40000 P1 Manager 12


E2 M. Smith Analyst 34000 P1 Analyst 24

E2 M. Smith Analyst 34000 P2 Analyst 6


E3 A. Lee Mech. Eng. 27000 P3 Consultant 10
E3 A. Lee Mech. Eng. 27000 P4 Engineer 48
E4 J. Miller Programmer 24000 P2 Programmer 18

E5 B. Casey Syst. Anal. 34000 P2 Manager 24

E6 L. Chu Elect. Eng. 40000 P4 Manager 48

E7 R. Davis Mech. Eng. 27000 P3 Engineer 36

E8 J. Jones Syst. Anal. 34000 P3 Manager 40


Deletion Anomaly
• If an engineer, who is the only employee on a project, leaves
the company, his personal information cannot be deleted, or
the information about that project is lost.
• May have to delete many tuples.
EMP

ENO ENAME TITLE SAL PNO RESP DUR

E1 J. Doe Elect. Eng. 40000 P1 Manager 12


E2 M. Smith Analyst 34000 P1 Analyst 24

E2 M. Smith Analyst 34000 P2 Analyst 6


E3 A. Lee Mech. Eng. 27000 P3 Consultant 10
E3 A. Lee Mech. Eng. 27000 P4 Engineer 48
E4 J. Miller Programmer 24000 P2 Programmer 18

E5 B. Casey Syst. Anal. 34000 P2 Manager 24

E6 L. Chu Elect. Eng. 40000 P4 Manager 48

E7 R. Davis Mech. Eng. 27000 P3 Engineer 36

E8 J. Jones Syst. Anal. 34000 P3 Manager 40


What to do?

Solution??

The University of Faisalabad, FSD 17


Thanks

The University of Faisalabad, FSD 18

You might also like