Introduction to Database Systems. Learning Objectives Role of Databases Database Definition DBMS and...

26
Introduction to Database Systems

Transcript of Introduction to Database Systems. Learning Objectives Role of Databases Database Definition DBMS and...

Introduction to Database Systems

Learning Objectives

Role of DatabasesDatabase DefinitionDBMS and its functionsKinds of DBMS’s

Relational databasesActors in the database EnvironmentSteps for designing a databaseA case study: A UNIVERSITY database

Role of Databases

Banks (amount deposit/ withdraw)Reservation Systems (hotel/ airline)Library CatalogsE-shoppingInventory

Note: Database is not a static entity, Data stored require regular update.

Database Definition

A database is a collection of related data.

A shared collection of logically related data (and a description of this data), designed to meet the information needs of an organization

How databases are created?

Databases may be created and maintained manually or it may be computerized.

Two ways to create and maintain a database: A group of application programs are

written specifically for that task. Database management system (DBMS)

DBMS: Database Management System

DBMS is a collection of programs that enables users to create and maintain a database.

The DBMS is a general-purpose software system that facilitates the processes of:

Defining Constructing Manipulating Sharing

Databases among various users and applications.

Defining a Database

Defining a database involves specifying: The data types Structures Constraints

of the data to be stored in the database.

A database is defined using Data Definition language (DDL)

The database definition or descriptive information is also stored in the database in the form of a database catalog or dictionary; called data dictionary, meta data or data about data.

Constructing a Database

It is the process of storing the data on some storage medium that is controlled by the DBMS.

Manipulating a Database

It includes functions as querying the database to retrieve specific data, updating (delete/ insert/ update) the database to

reflect changes, and generating reports from the data.

To manipulate a database DBMS uses Data Manipulation Language (DML).

Sharing a Database

Sharing a database allows multiple users and programs to access the database simultaneously.

Other functions of DBMS

Protecting a database System protection

Against hardware or software malfunction Security protection

Against unauthorized or malicious access

Maintaining over a long period of time

So What is a Database System?

The database and DBMS software together form a database system.

Kinds of DBMS’s

Hierarchical databasesNetwork databasesRelational databasesObject Oriented databases

Relational Databases

Bases on the concept of mathematical relationsData and relationships are represented as tables.Each relation has a unique nameA relation has a number of columns with a unique

name called attributes.A tuple is a row of a relation, also called as

record.Each relation has a unique attribute that differs

tuples from each other called as primary key.When the primary key becomes part of another

relation it is called as foreign key.

Steps for designing a database

Requirement definition and analysis it involves the collection and analysis of the

requirements of users and application areas.Conceptual Design

The requirements are transformed into a conceptual design that can be represented and manipulated using some computerized tools so that it can be easily maintained, modified and transformed into a database implementation.

A model called Entity Relationship Model (ERM) is used for this purpose.

Continued…

Logical Design The conceptual design is then translated into logical

design that can be expressed in a data model implemented in a commercial DBMS.

E.g. relational data model (A very popular one)Physical design

The final stage is the physical design in which further specifications are provided for storing and accessing the database.

The database design is implemented, populated with actual data and continuously maintained to reflect the state of the database.

Actors in the Database Environment

Data AdministratorDatabase AdministratorDatabase DesignersApplication ProgrammersEnd Users

Naïve Sophisticated

Data Administrator

Responsible for the management of data resources such as:

1. Database Planning2. Development and Maintenance of Standards3. Policies and Procedures4. Conceptual/ logical database design The DA consults with and advises senior

managers ensuring that the direction of database development will ultimately support corporate objectives.

Database Administrator

Responsible for the physical realization of the database such as:

1. Physical database design and implementation

2. Security and integrity control3. Maintenance for the operational system 4. Ensuring satisfactory performance for the

applications and users. The role of the DBA is more technically

oriented than DA.

Logical Database Designer

Logical database designer is concerned with: 1. Identifying the data

Entities and attributes

2. Relationships between the data3. Constraints on the data that is to be stored in the

database. The logical database designer must have a thorough

and complete understanding of the organization’s data and its business rules.

Business rules describe the main characteristics of data as viewed by the organization.

“a student cannot have more than six courses in a semester”

Physical Database Designer

The physical database designer takes the logical data model and decides how it is to be physically realized.

1. Mapping logical data model into a set of tables and integrity constraints.

2. Selecting specific storage structures and access methods for the data to achieve good performance for the database activities.

3. Designing any security measures required on the data.

Application Programmers

Once the database has been implemented, the application programs that provide the required functionality for the end-users must be implemented.

This is done by Application programmer.It includes:1. Retrieving data2. Inserting3. Updating 4. deleting

End Users

End users are clients for the database.Naïve users are typically unaware of the

DBMS.Sophisticated users are familiar with the

structure of the database and facilities provided by it.

Case Study: UNIVERSITY DATABASE

This database maintains information concerning students, courses and grades in a university environment.

Table1: STUDENTName Student_ID

(PK)Batch Major

Ahmed 17 Fall 2010 Computer Science

Ahmed 14 Fall 2011 Software Engineering

Table 2: COURSE

Course_Name Course_ID Credit Hours

Department

Database Systems

CS201 (PK)

4 Computer Science

Operating System

CS450 4 Computer Science

Differential Equations

MA102 3 Math

Table 3: GRADE REPORT

Student_ID (PK)

Course_ID (PK)

Semester Grade

22 CS112 Spring 2010

B

22 MA452 Fall 2011 B+

48 SE365 Spring 2009

A