RDBMS Concepts
RDBMS Concepts
What is Data?
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
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
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.
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.
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
Country
Greece
Currency
Drachma
ITA
Italy
Lira
IND
India
Rupee
CHN
China
Remnimbi
JPN
Japan
Yen
AUS
Australia
Dollar
FRN
France
Francs
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
Attributes
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
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.
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
3. Attributes
4. Relationships
16
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
Member Name
The E-R modeling technique uses the top-down approach. Normalization uses bottom-up approach.
21
Benefits of Normalization
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
26
27
Introduction to tables
28