Dbms
Dbms
Dbms
1
DATABASE MANAGEMENT SYSTEM
1) Introduction
2) Data -
3) Database
4) Database Management System(DBMS)
5) Disadvantages of file oriented approach
6) Difference between DBMS and File System
7) Function of DBMS
8) Advantages of DBMS and disadvantage of DBMS
9) Database Basics
10) Three level architecture of DBMS
11) Database users
12) Database languages
13) Database structure
The examples include deposit and/or withdrawal from a bank, hotel, airline or railway
reservation, purchase items from supermarkets in all cases, a database is accessed.
What is data:
Data is the known facts or figures that have implicit meaning. It can also be defined as it
is the representation of facts ,concepts or instruction in a formal manner, which is suitable
for understanding and processing. Data can be represented in alphabets(A-Z, a-z),in
digits(0-9) and using special characters(+,-.#,$, etc) e.g: 25, “ajit” etc.
Information:
2
Information is the processed data on which decisions and actions are based. Information
can be defined as the organized and classified data to provide meaningful values.
Data:
Database:
Examples of DBMS:
File:
3
The traditional file oriented approach to information processing has for each application a
separate master file and its own set of personal file. In file oriented approach the program
depends on the files and files become dependent upon the programs.
The same information may be written in several files. This redundancy leads to higher
storage and access cost. It may lead data inconsistency that is the various copies of
the same data may longer agree for example a changed customer address may be
reflected in single file but not else where in the system.
The conventional file processing system do not allow data to retrieved in a convenient
and efficient manner according to user choice.
3) Data isolation :
Because data are scattered in various file and files may be in different formats with
new application programs to retrieve the appropriate data is difficult.
4) Integrity Problems:
Developers enforce data validation in the system by adding appropriate code in the
various application program. How ever when new constraints are added, it is difficult
to change the programs to enforce them.
5) Atomicity:
4
It is difficult to ensure atomicity in a file processing system when transaction
failure occurs due to power failure, networking problems etc.
(atomicity: either all operations of the transaction are reflected properly in the
database or non are)
6) Concurrent access:
In the file processing system it is not possible to access a same file for
transaction at same time
7) Security problems:
There is no security provided in file processing system to secure the data from
unauthorized user access.
Elements of DBMS:
5
DML pre-compiler:
DDL compiler:
The DDL compiler converts the data definition statements into a set of tables. These
tables contains information concerning the database and are in a form that can be used by
other components of the dbms.
File manager:
File manager manages the allocation of space on disk storage and the data structure used
to represent information stored on disk.
Database manager:
A database manager is a program module which provides the interface between the low
level data stored in the database and the application programs and queries submitted to
the system.
1. Interaction with file manager: The data is stored on the disk using the file
system which is provided by operating system. The database manager
translate the different DML statements into low-level file system commands.
so The database manager is responsible for the actual storing, retrieving and
updating of data in the database.
2. Integrity enforcement: The data values stored in the database must satisfy
certain constraints(eg: the age of a person can't be less then zero).These
constraints are specified by DBA. Data manager checks the constraints and if
it satisfies then it stores the data in the database.
5. Concurrency control: When several users access the same database file
simultaneously, there may be possibilities of data inconsistency. It is the
responsibility of database manager to control the problems occurs for concurrent
transactions.
6
Query Processor:
The query processor used to interpret to online user’s query and convert it into an
efficient series of operations in a form capable of being sent to the data manager for
execution. The query processor uses the data dictionary to find the details of data file
and using this information it create query plan/access plan to execute the query.
Data Dictionary:
Data dictionary is the table which contains the information about database objects. It
contains information like
4. database authorization
Answer: Some main differences between a database management system and a file-
processing system are:
• Both systems contain a collection of data and a set of programs which access that
data. A database management system coordinates both the physical and the logical
access to the data, whereas a file-processing system coordinates only the physical
access.
7
file-processing system, a file can be accessed by two programs concurrently only
if both programs have read-only access to the file.
• Physical data independence is the ability to modify the physical scheme without
making it necessary to rewrite application programs. Such modifications include
changing from unblocked to blocked record storage, or from sequential to random
access files.
• Logical data independence is the ability to modify the conceptual scheme without
making it necessary to rewrite application programs. Such a modification might
be adding a field to a record; an application program’s view hides this change
from the program.
b. integrity enforcement.
c. security enforcement.
e. concurrency control.
If these responsibilities were not met by a given DBM (and the text points out that
sometimes a responsibility is omitted by design, such as concurrency control on a
single-user DBM for a micro computer) the following problems can occur,
respectively:
8
national defense secret codes, or employees could find out what their
supervisors earn.
Q. List six major steps that you would take in setting up a database for a particular
enterprise.
Answer: Six major steps in setting up a database for a particular enterprise are:
9
EXERCISES:
Data models
The data model describes the structure of a database. It is a collection of conceptual tools for
describing data, data relationships, data semantics and consistency constraints.
Various types of data model such as
3. Physical model
a. ER-model
b. Functional model
d. Semantic model
10
2. Record based logical model
b. Network model
c. Relational model
3. Physical model
Relational Data Model – It stores related data in logical units called tables. The data are
organized in terms of rows and columns.
1. View of Database
a. Physical level
b. Logical level
c. View level
2. Data Independence
a. Physical Data Independence
b. Logical data Independence
3. Entity
4. Entity Set
5. Attribute
6. Relationship
7. Schema
a. Physical Schema
b. Logical Schema
8. Instance
9. Key
a. Primary Key
i. Simple
ii.Composite
b. Foreign Key
c. Super Key
d. Candidate Key
e. Alternate Key
f. Secondary Key
11
Regd no Name Address
101 Sachin CTC
10. Data Abstraction - superfluous
102 Saurav BBSR
a. Specialization
103 Rahul CTC
b. Generalization
104 Sachin RKL
11. Aggregation
105 Rahul BBSR
12. Strong Entity Set
13. Weak Entity Set
14. Multi Valued Attribute
15. Derived Attribute
16. Identifying relationship
17. Discriminating attribute/ Discriminator / Partial key
18. Many to may relationship
19. Many to one relationship
20. One to one relationship
21. Composite Attribute
22. Domain
STUDENT_INFO
12
(Name, Address) -
EXAMINATION
102 MCA 1 PC 94
(Regd No, Subject) ---- is the key ---- Composite Primary Key
FOREIGN KEY
EXAMINATION
102 MCA 1 PC O
GRADEINFO
SUPER KEY
13
Such augmented set is called a super key.
CANDIDATE KEY
ALTERNATE KEY
SECONDARY KEY
1. Budget
2. Make
3. Color
4. Features
STUDENT
14
STUDENT
Specialization Generalization
is_a
EX - STUDENT CU - STUDENT
STUDENT EXAM
AGGREGATION
15
VISITOR
NAME MOBILE
REGDNO
STUDENT
DEPENDENTS
16
17
18
One to One relationship
COLLEGE PRINCIPAL
STUDENT COURSE
COLLEGE CLASSES
TEACHER STUDENT
M N
19
TOTAL PARTICIPATION AND PARTIAL PARTICIPATION
GAMES
STUDENTS
COMPOSITE ATTRRIBUTE
Database Languages
RELATIONAL ALGEBRA
1. Select
2. Project
3. Union
4. Set Intersection
5. Set Difference
6. Cartesian Product
20
7. Rename
8. Division
9. Natural Join
10. Assignment
Select -
MP
emp# name
101 Sachin
102 Saurav
103 Ajay
ASSIGNED_TO
project# emp#
CS353 101
CS354 102
CS353 103
CS355 107
CS354 105
CS355 108
PROJECT
project# project_name Manager
CS353 Database 107
CS354 VB 105
CS355 Database 108
RELATIONAL AGEBRA
1. To display the project# and emp# of those who work on project CS353.
We need only ASSIGNED_TO
project# emp#
CS353 101
CS353 103
project#
21
CS353
CS354
CS355
project# project_name
CS353 Database
CS354 VB
CS355 Database
4. To display the employee no of those who work on project CS353.
We need only ASSIGNED_TO
emp#
101
103
5. To display the project# and manager of those projects where project name is Database.
We need PROJECT
project# Manager
CS353 107
CS355 108
Set operations
6. To display the project# and emp# of those who work in CS353 or CS354
9. To display the emp# of those who work in CS353 but not in CS354.
10.
11. To display the employee name of those who work on Database project.
A B
A1 B1
22
A1 B2
A2 B1
A3 B1
A4 B2
A5 B1
A5 B2
P ÷Q
R
A
A1
A2
A3
A4
A5
JOIN
1.CARTESIAN
2.EQUI
3.NON EQUI
23
4.SELF
5.OUTER
6.NATURAL
7.THETA
8.SEMI
roll no Name
101 Sachin
102 Saurav
103 Ajay
101 Sachin
Key
STU_INFO
Roll Name Father’s address mobile
name
101 Abhisek
102 Ajay
24
STU_EXAM
Roll course semester Subject mark
101 MCA 1 DE 94
101 MCA 1 OS 92
PC and DS
101 MCA 1 89
101 MCA 1 Math 90
101 MCA 1 CA 95
102 MCA 1 DE 87
102 MCA 1 OS 92
25