Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

IMIT, Cuttack

MCA 1st Semester


MCA 01005 Database Engineering
Syllabus

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

DBMS: Basic Concepts


Introduction:

In computerized information system, data is the basic resource of the


organization. So, proper organization and management for data is required for
organization to run smoothly. Database management system deals the knowledge of how
data stored and managed on a computerized information system. In any organization, it
requires accurate and reliable data for better decision making, ensuring privacy of data
and controlling data efficiently.

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.

Eg: “The age of Ravi is 25”

Data:

Raw fact is called Data.

Database:

A database is organized collection of related data of an organization stored in formatted way.

Database Management System(DBMS):

It is a collection of well organized databases and a set of programs to manage the


databases.

Examples of DBMS:

1. Oracle from Oracle Corporation


2. DB2 from IBM
3. SQL Server from Microsoft Corporation
4. MS Access from Microsoft Corporation
5. Lotus from IBM
6. FoxPro
7. Sybase
8. dBASE
9. Quest
10. Paradox

File:

File is a collection of related data stored in secondary memory.

File Oriented approach:

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.

Difference between DBMS and File System

Sl. No. DBMS File System


1. No Data Redundancy Data Redundancy
2. Data Consistency Data Inconsistency
3. Data can be accessed conveniently Difficulty in accessing Data
4. No data Isolation Data Isolation
5. Data Integrity Integrity Problem
6. Atomicity Atomicity Problem
7. Concurrent Access to Data Concurrent Access Problem
8. Security Security Problem

Disadvantages of file oriented approach:

1) Data redundancy and inconsistency:

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.

2) Difficulty in accessing data :

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.

DBMS System Architecture

Elements of DBMS:

5
DML pre-compiler:

It converts DML statement embedded in an application program to normal procedure


calls in the host language. The pre-complier must interact with the query processor in
order to generate the appropriate code.

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.

The responsibilities of database manager are:

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.

3. Security enforcement: Data manager checks the security measures for


database from unauthorized users.
4. Backup and recovery: Database manager detects the failures occurs due to
different causes (like disk failure, power failure, deadlock, s/w error) and
restores the database to original state of 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

1. external, conceptual and internal database description

2. description of entities , attributes as well as meaning of data elements

3. synonyms, authorization and security codes

4. database authorization

The data stored in the data dictionary is called meta data.

Q. List four significant differences between a file-processing system and a DBMS.

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.

• A database management system reduces the amount of data duplication by


ensuring that a physical piece of data is available to all programs authorized to
have access to it, where as data written by one program in a file-processing
system may not be readable by another program.

• A database management system is designed to allow flexible access to data (i.e.,


queries), whereas a file-processing system is designed to allow predetermined
access to data (i.e., compiled programs).
• A database management system is designed to coordinate multiple users accessing
the same data at the same time. A file-processing system is usually designed to
allow one or more programs to access different data files at the same time. In a

7
file-processing system, a file can be accessed by two programs concurrently only
if both programs have read-only access to the file.

Q.Explain the difference between physical and logical data independence.

• 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.

Q. List five responsibilities of a database management system. For each


responsibility, explain the problems that would arise if the responsibility were not
discharged.
Answer: A general purpose database manager (DBM) has five responsibilities:

a. interaction with the file manager.

b. integrity enforcement.

c. security enforcement.

d. backup and recovery.

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:

a. No DBM can do without this, if there is no file manager interaction then


nothing stored in the files can be retrieved.
b. Consistency constraints may not be satisfied, account balances could go
below the minimum allowed, employees could earn too much overtime
(e.g.,hours > 80) or, airline pilots may fly more hours than allowed by law.
c. Unauthorized users may access the database, or users authorized to access
part of the database may be able to access parts of the database for which
they lack authority. For example, a high school student could get access to

8
national defense secret codes, or employees could find out what their
supervisors earn.

d. Data could be lost permanently, rather than at least being available in a


consistent state that existed prior to a failure.
e. Consistency constraints may be violated despite proper integrity
enforcement in each transaction. For example, incorrect bank balances
might be reflected due to simultaneous withdrawals and deposits, and so
on.

Q. What are five main functions of a database administrator?


Answer: Five main functions of a database administrator are:

To create the scheme definition

To define the storage structure and access methods

To modify the scheme and/or physical organization when necessary

To grant authorization for data access

To specify integrity constraints

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:

Define the high level requirements of the enterprise (this step


generates a document known as the system requirements
specification.)

Define a model containing all appropriate types of data and data


relationships.

Define the integrity constraints on the data.

Define the physical level.

For each known problem to be solved on a regular basis (e.g., tasks to


be carried out by clerks or Web users) define a user interface to carry
out the task, and write the necessary application programs to
implement the user interface.

Create/initialize the database.

9
EXERCISES:

1. What is database management system

2. What are the disadvantage of file processing system


3. State advantage and disadvantage of database management system

4. What ate different types of database users

5. What is data dictionary and what are its contents

6. What are the function of DBA

7. What are the different database languages explain with example.

8. Explain the three layer architecture of DBMS.

9. Differentiate between physical data independence and logical data independence

10. Explain the function of data base manager

11. Explain meta data

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

1. Object based logical model

2. Record based logical model

3. Physical model

Types of data model:

1. Object based logical model

a. ER-model

b. Functional model

c. Object oriented model

d. Semantic model

10
2. Record based logical model

a. Hierarchical database 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.

BUZZ WORDS in RDBMS

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

ROLL NAME ADDRESS PHONE NATIONALITY COURSE


101 Sachin CTC 976541234 Indian MCA
102
103
104
105

Instance – changes frequently

Schema - changes infrequently

Regd No --- Key - Simple Primary Key

Name – Not a key

Address – Not a key

12
(Name, Address) -

EXAMINATION

Regd No Course Semester Subject Mark


101 MCA 1 PC 98
101 MCA 1 Math 97

102 MCA 1 PC 94

(Regd No, Course) X

(Regd No, Subject) ---- is the key ---- Composite Primary Key

FOREIGN KEY

EXAMINATION

Regd No Course Semester Subject Mark


101 MCA 1 PC O
101 MCA 1 Math A

102 MCA 1 PC O

Primary Key Foreign Key

GRADEINFO

Grade Min Mark Max Mark


O 90 100
A 80 89
B 70 79

SUPER KEY

13
Such augmented set is called a super key.

Regd no --- Primary key

(Regd No, Name) – Super Key

Regd No, Sub --- Primary key

(Regd No, Sub. Mark) --- Super Key

CANDIDATE KEY

Sl. No. --- Yes

Regd No --- Yes

(Name, Address) --- Yes

ALTERNATE KEY

SECONDARY KEY

Example – Purchase of a car

1. Budget
2. Make
3. Color
4. Features

Budget Make Color Features

STUDENT
14
STUDENT
Specialization Generalization

is_a

EX - STUDENT CU - STUDENT

STUDENT EXAM

AGGREGATION

15
VISITOR

NAME MOBILE
REGDNO

STUDENT

NAME RELATIONSHIP DOB

DEPENDENTS

16
17
18
One to One relationship

COLLEGE PRINCIPAL

One to Many relationship

STUDENT COURSE

One to Many Relationship

COLLEGE CLASSES

Many to Many Relationship

TEACHER STUDENT

M N

19
TOTAL PARTICIPATION AND PARTIAL PARTICIPATION

GAMES
STUDENTS

COMPOSITE ATTRRIBUTE

Database Languages

1. Procedural – Relational Algebra, SQL


2. Non Procedural – Tuple Calculus, Domain Calculus, QBE(Query By Example)

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

2. To display all project numbers in the company.


We need only PROJECT

project#

21
CS353
CS354
CS355

3. To display all project numbers and names in the company.


We need only PROJECT

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

7. To display the emp# of those who work in CS353 or CS354.

8. To display the emp# of those who work in CS353 and 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

Redundancy – Unnecessarily duplication of data


Roll Name Father’s address mobile course semester Subject mark
name
101 Abhisek MCA 1 DE 94
101 Abhisek MCA 1 OS 92
PC and DS
101 Abhisek MCA 1 89
101 Abhisek MCA 1 Math 90
101 Abhisek MCA 1 CA 95
Divide it into 2 tables

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

You might also like