Vous êtes sur la page 1sur 28

RDBMS Concepts

What is Data?

Data is the most important component in any work that we do

The role of data in business


What's a database? A database is a collection of data organized in a particular way.
2

What is a Database Management System? A database management system (DBMS) is a set of programs used to define, administer, and process databases and their associated applications.
3

Objectives of DBMS

Data Consolidation

It refers to the combining or unifying of separate data files into a centralized structure, and storing the data in a non-redundant format. It refers to the ability of the system to allow multiple users concurrent access to individual pieces of data in a database.

Data Sharing

Data Protection
4

Basic services provided by DBMS


Moving data to and from the physical data files as needed. Managing concurrent data access by multiple users, including provisions to prevent simultaneous updates from conflicting with one another. Managing transactions so that each transactions database changes are an all-or-nothing unit of work. Support for a query language Provisions for backing up the database and recovering from failures. Security mechanisms to prevent unauthorized data access and modification.
5

Database Models

Flat File Database System


Data generally stored in one or more files. There is no relational depth to the storage. Is very fast and easy to retrieve the data. Redundant data entry. Difficulty of updating the information.

Hierarchical Database System

Defines relationships between records based on hierarchical structure(parent- child). Limitations

A record can be a child of only one parent. Defined relationship between child and parent can never change. Only by going through the appropriate parent record can we can access the child records.

Relational Database System


Data gets segmented into tables. Tables are peers with one another. Eliminates data redundancy(normalization). Dr. E. F. Codd of IBM first formulated the relational database model in 1970

Relational Model Detail


Code
GRC

Country
Greece

Currency
Drachma

ITA

Italy

Lira

IND

India

Rupee

CHN

China

Remnimbi

JPN

Japan

Yen

AUS

Australia

Dollar

FRN

France

Francs

Why relational is better

In applications written with DBMSs that follow the hierarchical or network model, database structure is hard-coded into the application that is, the application is dependent on the specific physical implementation of the database. If you add a new attribute to the database, you must change your application to accommodate the change, whether or not the application uses the new attribute.
10

Domain

A Domain is a pool of values from where one or more attributes (columns) can draw their actual values. For example, the values in the field Country are available from the names of all the countries in the world. Hence, the domain for this filed is country.

Tuple

They are the rows that the table is made up of.


The term attribute refers to characteristics.
11

Attributes

Difference between a DBMS and a RDBMS

The concept of relationships is missing in a DBMS. If it exists it is very less. Speed of operation is very slow. Hardware and Software requirements are less. Facilities and Utilities offered are limited. Platform used is normally DOS

It is based on the concept of relationships. Speed of operation is very fast. Hardware and Software requirement are very high. Facilities and Utilities offered are many. Platforms used can by any DOS, UNIX, etc. Uses concept of a table RDBMS normally use a 4GL. Examples are ORACLE, INGRES, etc.
12

Uses concept of a file. DBMS normally use a 3GL. Examples are dBase, FoxBase, etc.

Kinds of Relations

1. Base Tables It is table with a name that physically exists in a database 2. Query results When a question is asked to a table, the resultant data is also stored in tables. Such tables are called query result tables. 3. Views A view is a virtual table

13

Data Integrity Constraints


Entity integrity The entity integrity rule states that no component of the primary key of a base table is allowed to accept NULL values Referential Integrity This rule states that the database must not contain any unmatched foreign key values.

a. Cascade The change is reflected in all relevant tables. For example, if an employee leaves the company and his record is deleted from the employee table, the all the records for that employee are also deleted form the dependent tables as well b. Restrict The change is rejected unless there are no matching foreign key values in other tables c. Nullify When a change is made in the primary key column, the values in the foreign key are set to null. d. Customized Some systems provided the capability of creating triggers that enforce business rules when the user updates or deleted records in a table
14

Attribute Integrity Values within a column must be consistent with the defined data type and format of that column.

Business Rule Integrity

Values stored must comply with the rules of the business

Eg:- A project must start on a weekday

15

Entity-Relationship model
The ER data model is based on the object-based logical models. This model comprises of
1. Entities An entity can be defined as anything, which can be distinctly identified.

2. Entity Set

An entity set is a set of entities of the same type

3. Attributes

Each entity has a specific characteristic that is defined by the attribute.

4. Relationships

-an association among entities.

16

Relationships in a relational database model are categorized as:


One to One
Each employee is given a unique employee number and since any one employee can have only one employee number, this is called One to One relationship

One to Many
Each department will have several employees working This is an example of One to Many relationship. under it.

Many to Many
if a single record in the first table points of more than one record in the second table and a single record in the second table points to many records in the first table.
17

E-R Diagrams

A rectangle to denote and entity or an entity set. A diamond to denote a relationship between two entities An oval to denote attributes A 1 to denote a single occurrence An M to denote multiple occurrences A line which links attributes to an entity or entity set and entity sets to relationships
18

Empno

Empname Deptno

Employee

Works For

Department

M
Salary

1
Deptname

19

Normalization
A Library maintains a register of all the books issued to its members.

No.

Name of Book

Borrowed by

Date of Date of issue Return

Separate list of members

Member Name

Address and Tele No


20

There are two ways of approaching logical database design:


1. The top-down approach 2. The bottom-up approach

The E-R modeling technique uses the top-down approach. Normalization uses bottom-up approach.
21

Benefits of Normalization

Inconsistency in data retrieval Errors while updating data tables

22

Absence of Normalization:
No. Book Borrowed Address Tele Date of Date Name by issue of return
Everything in one table Data redundancy Change of address will be many.

23

Normal Forms

First Normal Form (1st NF) Second Normal Form (2nd NF) Third Normal Form (3rd NF) Boyce-Codd Normal Form

In order to understand more about normal forms, lets see functional dependency.

24

Functional Dependency
Is a relationship between attributes(fields).
Eg :-Telephone no is functionally dependent on the member name.

25

Data in the librarians register


MemName JOE SAM PENNY PETER Contact Bookcode CatCode IssueDate DueDate 4142319 8042319 423019 783019 B020 B189 B021 B022 B023 B024 Science 18-3-98 18-4-98 Astro 18-3-98 18-4-98 18-3-98 18-4-98 CLASSIC 20-3-98 20-4-98 20-3-98 20-4-98 ADVENTURE 20-3-98 20-4-98

26

1ST Form 2nd Form 3rd Form

Denormalization eg:- Penalty calculation

27

Introduction to tables

Components of a table Primary key Alternate key Foreign key

28