Professional Documents
Culture Documents
Dbms-3bcom-1-3 Units
Dbms-3bcom-1-3 Units
Dbms-3bcom-1-3 Units
• Data Availability: Data availability refers to the fact that the data are made available to
wide variety of users in a meaningful format at reasonable cost so that the users can
easily access the data.
• Data Integrity: Data integrity refers to the correctness of the data in the database. In
other words, the data available in the database is a reliable data.
• Data Security : Data security refers to the fact that only authorized users can access the
data. Data security can be enforced by passwords. If two separate users are accessing a
particular data at the same time, the DBMS must not allow them to make conflicting
changes
• Data Independence : DBMS allows the user to store, update, and retrieve data in an
efficient manner. DBMS provides an “abstract view” of how the data is stored in the
database. In order to store the information efficiently, complex data structures are used to
represent the data. The system hides certain details of how the data are stored and
maintained.
Evolution of Database Management
Systems
• File-based system was the predecessor to the database management
system. Apollo moon-landing process was started in the year 1960. At
that time, there was no system available to handle and manage large
amount of information. As a result, North American Aviation which is
now popularly known as Rockwell International developed software
known as Generalized Update Access Method (GUAM).
• In the mid-1960s, IBM joined North American Aviation to develop GUAM
into Information Management System (IMS). IMS was based on
Hierarchical data model. In the mid-1960s, General Electric released
Integrated Data Store (IDS).
• IDS were based on network data model. Charles Bachmann was mainly
responsible for the development of IDS. The network database was
developed to fulfill the need to represent more complex data
relationships than could be modeled with hierarchical structures.
• Conference on Data System Languages formed Data Base Task Group (DBTG) in 1967. DBTG
specified three distinct languages for standardization. They are Data Definition Language
(DDL), which would enable Database Administrator to define the schema, a subschema DDL,
which would allow the application programs to define the parts of the database and Data
Manipulation Language (DML) to
• manipulate the data. The network and hierarchical data models developed during that time
had the drawbacks of minimal data independence, minimal theoretical foundation, and
complex data access.
• To overcome these drawbacks, in 1970, Codd of IBM published a paper titled “A Relational
Model of Data for Large Shared Data Banks” in Communications of the ACM, vol. 13, No. 6,
pp. 377–387, June 1970.
• As an impact of Codd’s paper, System R project was developed during the late 1970 by IBM
San Jose Research Laboratory in California. The project was developed to prove that
relational data model was implementable. The outcome of System R project was the
development of Structured Query Language (SQL) which is the standard language for
relational database management system.
• In 1980s IBM released two commercial relational database management systems known as
DB2 and SQL/DS and Oracle Corporation released Oracle.
• In 1979, Codd himself attempted to address some of the failings in his original work with an
extended version of the relational model called RM/T in 1979 and RM/V2 in 1990.
• In recent years, two approaches to DBMS are more popular, which are Object-
Oriented DBMS (OODBMS) and Object Relational DBMS (ORDBMS). The
chronological order of the development of DBMS is as follows:
• Flat files – 1960s–1980s
• Hierarchical – 1970s–1990s
• Network – 1970s–1990s
• Relational – 1980s–present
• Object-oriented – 1990s–present
• Object-relational – 1990s–present
• Data warehousing – 1980s–present
• Web-enabled – 1990s–present
• Early 1960s. Charles Bachman at GE created the first general purpose DBMS
Integrated Data Store. It created the basis for the network model which was
standardized by CODASYL (Conference on Data System Language).
• Late 1960s. IBM developed the Information Management System (IMS). IMS
used an alternate model, called the Hierarchical Data Model.
• 1970. Edgar Codd, from IBM created the Relational Data Model.
• In 1981 Codd received the Turing Award for his contributions to database
theory. Codd Passed away in April 2003.
• 1976. Peter Chen presented Entity-Relationship model, which is widely used
in database design. 1980. SQL developed by IBM, became the standard query
language for databases. SQL was standardized by ISO.
• 1980s and 1990s. IBM, Oracle, Informix and others developed powerful
DBMS.
Classification of Database Management
System
• The database management system can be broadly classified into two categories, they
are
• (1) Passive Database Management System
• (2) Active Database Management System
• 1. Passive Database Management System.
• Passive Database Management Systems are program-driven. In passive database
management system the users query the current state of database and retrieve the
information currently available in the database. Traditional DBMS are passive in the
sense that they are explicitly and synchronously invoked by user or application program
initiated operations. Applications send requests for operations to be performed by the
DBMS and wait for the DBMS to confirm and return any possible answers. The
operations can be definitions and updates of the schema, as well as queries and updates
of the data.
2. Active Database Management System.
Active Database Management Systems are data-driven or event-
driven systems. In active database management system, the users specify
to the DBMS the information they need. If the information of interest is
currently available, the DBMS actively monitors the arrival of the desired
information and provides it to the relevant users. The scope of a query in
a passive DBMS is limited to the past and present data, whereas the
scope of a query in an active DBMS additionally includes future data. An
active DBMS reverses the control flow between applications and the
DBMS instead of only applications calling the DBMS, the DBMS may also
call applications in an active DBMS.
UNIT-II
Historical Roots of File and File System
• In olden days records are maintained in traditional file systems. File system
means organization of files.
• File is a collection (or) group of records. A record is collection of fields. Where
the field contains the real data. For ex: Student file, Where we maintain all
students record consisting of Roll No, name, group, marks, average.
• In the olden days the file system maintains all the files in flat manner (flat
files/text-files). The flat file permits to search any record in sequential access
only. It was cumbersome and slow. To overcome the slowness they have gone
for Index file system which was faster in accessing in random manner. But it
occupies extra memory to maintain Index table.
• In general in the file system all the data has to be stored in the
corresponding folders (or) directories. For ex: In a college we can
maintain admission details of students. Suppose the director wants to
know today’s admission status group wise in that case the file manager
(or) clerk has to open each folder to answer the director’s question.
That’s why it is time consuming, memory consuming, may be error
prone.
• To over come this, the data base system has evolved. Which uses the
4GL language i.e. SQL. Which allows answering any query?
• The DBMS maintains all the records in the form of tables by means of
rows and columns. But in DBMS before storing the data the schema has
to be created with the help of DDL.
File system
• Assume maintaining the first year student’s data using file systems.
BBA BBA B.Com B.Com
• Folder name
• Roll No, name, fees Roll No, name, fees
• Every folder contains all the relevant fields which occupy extra
memory, calculation is slow. Constraints cannot be imposed in File
systems DBMS.
Roll No Name Branch Fees
60012 Gopal B.Sc 20000
Publishers
Publishers
C_Name C_Street
Acc_Num balance
Cust_Id C_City
deposit
CUSTOMER or ACCOUNT
Object oriented data base model
• An OO programming language allows the programmer to work with
objects to a time an application that interacts with a relational
database. During the last few years, object oriented programming has
become popular with languages such as C++, VB & Java. For ex.
Elements within a program or database application are usually
represented as objects. These objects have properties, which can be
modified, and can also be inherited from other objects. Related types
of objects are assigned various properties that can be adjusted to
define the particular object and determine how the object will act.
Object Relational Database Model
• Although some major seems exist between the object oriented and relational
models, the object relational model was developed with the objective of the
concepts of the relational databases model with object-oriented programming
style. The OR model is supposed to represent the best of both workers
( relational & OO ), although OR model is still early in development.
Person
Eno fname varchar
E_inf person &name varchar
Address_inf address initial varchar
Phone number
Address
Street varchar
City varchar
State varchar
Components and Interfaces of Database Management
System
Procedure:Procedures are the rules that govern the design and the use of database.
Components of Database Environment:
The major components of a typical database environment and
their relationships are shown below
• Computer-aided software engineering (CASE) tools : CASE Tools are automated
tools used to design databases and application programs.
• Repository: Repository is Centralized knowledge base for all data definitions, data
relationships, screen and report formats, and other system components. A
repository contains an extended set of metadata important for managing
databases as will as other components of an information system.
• Database management system (DBMS): DBMS is a Commercial software (and
occasionally, hardware and firmware) system, which is used to define, create,
maintain, and provide controlled access to the database and also to the repository.
In other words DBMS is collection of logically related data and set of programs to
operate data.
• Database: Database is an organized collection of logically related data, usually
designed to meet the information needs of multiple users in an organization. It is
important to distinguish between the database and the repository. The repository
contains definitions of data, whereas the database contains occurrences of data.
• Application Programs: Application programs are Computer programs that are
used to create and maintain the database and provide information to users.
• User interface Languages, menus, and other facilities by which users
interact with various system components, such as CASE tools, application
programs, the DBMS, and the repository.
• Data administrators Persons who are responsible for the overall
information resources of an organization. Data administrators use CASE
tools to improve the productivity of database planning and design.
• System developers Persons such as systems analysts and programmers
who design new application programs. System developers often use
CASE tools for system requirements analysis and program design.
• End users Persons throughout the organization who add, delete, and
modify data in the database and who request or receive information
from it. All user interactions with the database must be routed through
the DBMS.
Ranges of Database Applications
The range of database applications can be divided into five categories: Personal
databases, workgroup databases, department databases, enterprise databases,
and Internet, Intranet, and Extranet databases.
Personal Databases:
Personal databases are designed to support one user. Personal databases have
long resided on personal computers (PCs), including laptops. Recently the
introduction of personal digital assistants (PDAs) has incorporated personal
databases into handheld devices that not only function as computing devices but
also as cellular phones, fax senders, and Web browsers.
• Personal databases are widely used because they can often improve personal
productivity. However, they entail a risk: The data cannot easily be shared with
other users. For this reason, personal databases should be limited to those rather
special situation (such as in a very small organization) where the need to share
the data among users of the personal database is unlikely to arise.
Workgroup Database:
A workgroup is a relatively small team of people who collaborate
on the same project or application or on a group of similar projects or
applications. A workgroup typically comprises fewer than 25 persons.
A workgroup database is designed to support the collaborative efforts
of such a team.
• The method of sharing the data in this database is shown in below
figure. Each member of the workgroup has a desktop computer and
the computers are linked by means of a local area network (LAN). The
database is stored on a central device called the database server,
which is also connected to the network. Thus each member of the
workgroup has access to the shared data.
• Workgroup database with local area network
Project Manager
Developer 1 Developer n Librarian
Database server
Workgroup database
Department Databases:
A department is a functional unit within an organization. Typical examples
of department are personnel, marketing, manufacturing, and accounting.
A department is generally larger than a workgroup (typically between 25
and 100 persons) and is responsible for a more diverse range of functions.
• Department databases are designed to support the various functions and
activities of a department
Enterprise Databases
An enterprise database is one whose scope is the entire
organization or enterprise (or, at least, many different departments).
Such databases are intended to support organization-wide operations
and decision making. An enterprise database does, however, support
information needs from many departments. Over the last decade, the
evolution of enterprise databases has resulted in two major
developments:
1. Enterprise resource planning (ERP) systems
2. Data warehousing implementations.
• An enterprise data warehouse
Branch
Office -1
Branch
Office-2
Branch
Office-5
Internet, Intranet and Extranet Databases
Some of the popular DBMS vendors and their corresponding products are as follows
vendor product
IBM –DB2/MVS
–DB2/UDB –DB2/400
–Informix Dynamic Server (IDS)
Microsoft –Access
–SQLServer
–DesktopEdition(MSDE)
Open Source –MySQL
–PostgreSQL
Oracle –Oracle DBMS
–RDB
Sybase –Adaptive Server Enterprise (ASE)
–Adaptive Server Anywhere (ASA)
–Watcom
Different views of Database/Abstraction
Conceptual Level
Conceptual
Item-Number Character (6)
Physical Level Item-Name Character (20)
Price Numeric (5+2)
Reorder-quantity Numeric (4)
Internal
Stored-Item Length = 40
Item# Type = Byte (6), Offset = 0, Index = 1x
Name Type = Byte (20), Offset = 6
Price Type = Byte (8), Offset = 26
ROQ Type = Byte (4), Offset = 34
UNIT –
III
Building Blocks of an Entity–Relationship Diagram
• Attribute
• Relationship
Classification of Entity Sets
Entity Set
Strong Entity
Strong entity is one whose existence does not depend on other entity.
Example
• Consider the example, student takes course. Here student is a strong
entity
depends
EMPLOYEE DEPENDENTS
Associative entity
An associative entity is a term used in relational and entity–relationship
theory. A relational database requires the implementation of a base
relation (or base table) to resolve many-to-many relationships. A base
relation representing this kind of entity is called, informally, an associative
table.
Attribute Classification
Attribute is used to describe the properties of the entity. This attribute can be
broadly classified based on value and structure. Based on value the attribute
can be classified into single value, multivalue, derived, and null value attribute.
Based on structure, the attribute can be classified as simple and composite
attribute
Symbols Used in ER Diagram
Ternary Relationship
In a ternary relationship, three entities are simultaneously involved. Ternary
relationships are required when binary relationships are not sufficient to
accurately describe the semantics of an association among three entities
Specialization and Generalization (or)
Characteristics of Super type/Subtypes
• In the above relation cust-Id is the primary key. So all of the remaining
attributes are functionally dependent on this attribute. However there is a
transitive dependency. The attribute region is functionally dependent the
attributes salesperson-Id. So we decompose the above relation into new
relations that satisfy our 3rd normal form.
CUSTOMER
Cust-Id Cust-Name Salesperson-Id
SALES
Salesperson-Id Region
ADVISER
Subject Adviser
2) Fourth Normal Form:
A relation is in fourth normal form if it is in Boyce codd normal form and
no multi valued dependency. Here multi-valued dependency is a functional
dependency that exists a non-key attribute is functionally dependent on two
or more sets of primary key attributes.
• For example consider a relation student contains attributes like st-No, st-
Name, course-Id and grade. Here primary key is a composite key of st-No,
st-Name, course-Id. In the above example the non-key attribute grade is
functionally dependent on st-no, course-Id, and st-name, course-Id.
STUDENT
St-No St-name Course-Id Grade
St-No, course-Id grade
St-Name, course-Id grade
The above relation contains multi-valued dependency. So it is not in fourth
normal form. To avoid the multi-valued dependency we decompose the above
relations into new relations.
St-No St-Name
a1 b1
(i)
a2
One
a3 – to
a4
One – to - One
• EXAMPLE
a1 b2
b3
a2
b4
b5
Example:
One - to - One
(iii) Many – to – One An entity in A is associated with at most one entity
in B. An entity in B however, can be associated with any number of
entities in A.
a1
b1
a2
b2
a3
b3
a4
a5
Many – to - One
• Example:
PRODUCT Product_Line
Contains
Many - to - One
(iv) Many-to-Many An entity in A is associated with any number of entities in
B and an entity in B is associated with any number of entities in A.
a1 b1
a2 b2
a3 b3
a4 b4
Example:
STUDENT Registers- Course
for
Entity Relationship model constructs(ER Model)
• Weak entity: An entity set may not have sufficient attributes to form a primary
key such entity set is termed as weak entity set (or) An entity type whose
existence depends on some other entity type is called weak entity type. weak
entity type has no meaning in the E- R diagram without the entity on which it
depends. the entity type on which the weak entity type depends is called “the
identifying owner” (or) simply called “owner” . Weak entity is denoted by a
symbol double lined Box.
Identity Relationship : The relationship that associates the weak entity set
with an owner is the identifying relationship.
Attributes: property or characteristic of an entity type that is of interest to
the organization is called attribute. An attribute is denoted by a symbol ellipse
• Ex:
FACULTY
• In above example
F_Id,Name,Dob,Age,Skill
Qualification
are attributes of the FACULTY
FACULTY entity.
Types of attributes
No.of
passengers
Flight-id
Course-id Course-title
Employee-id Employee-
name
Topic
Birthdate
• This is a many-To- many relationship since each employee may complete any no. of
course, while a given course may be completed by any no. of employees.
• Associative Entities : An associative entity is an entity type that associates the
instances of one or more entity types and contains attributes that are peculiar to the
relationships between those entity instances,
• In the E-R model associative entities are represented with the diamond relationship
symbol enclosed within entity box. The purpose of this symbol is to preserve the
information that the entity was initially specified as a relationship on E-R Model.
• An associative entity (Certificate)
Course -Title
Foreign key
ITEM ITEM
Item # Items-Name Price
Item # Item-Name price
I1 Milk 15.00
I1 Milk 15.00
I2 Cake 5.00
I4 Milk bread 14.00 I7 Ice cream 16.00
I5 Plain biscuit 6.00 I9 Namkeen 15.00
I6 Cream biscuit 10.00
I7 Ice cream 16.00
I8 Namkeen 15.00
2. The project operation
The project operation yields a “vertical” subset of a given relation.
The projection lets you select specified attributes in a specified order.
Projection is denoted by (Pi)
• Ex: To project supplier names and their cities from the relation suppliers,
we shall write Supp-Name, city (suppliers)
• The relation resulting from this query is as shown in fig (b)
SUPPLIER
Supp # Supp-Name Status city
S1 Britannia 10 Delhi
S2 New Bakers 30 Mumbai
S3 Mother Dairy 10 Delhi
S4 Cookz 50 Bangalore
S5 Haldiram 40 jaipur
Fig (a)
SUPPLIER
Supp-Name City
Britannia Delhi
New Bakers Mumbai
Mother dairy Delhi
Cookz Bangalore
Haldiram jaipur
• The Cartesian product operation
• The Cartesian product is a binary operation and is denoted by a cross (X). The
Cartesian product of two relation A and B is written as A x B. The Cartesian
product yields a new relation which has a degree (number of attributes) equal
to the sum of the degrees of the two relations. Operated upon. The Cartesian
product of two relations yields a relation with all possible combinations of the
tuples of the two relations operated upon. Let us consider how does it work
let us assume there are two relations student and Instructor
STUDENT INSTUUCTOR
Stud # Stud-Name Hosteler INST# INST-Name subject
S001 Meenakshi Y 101 K.Lal English
S002 Radhika N
102 R.L.Arora Maths
S003 Abhinav N
The resulting relation has been shown in below figure student x Instructor
The resulting relation contains all possible combinations of tuples of the two relations.
STUDENT_INSTUUCTOR
Stud # Stud-Name Hosteler INST# INST-Name Subject
S001 Meenakshi Y 101 K.Lal English
S001 Meenakshi Y 102 R.L.Arora Maths
S002 Radhika N 101 K.Lal English
S002 Radhika N 102 R.L.Arora Maths
S003 Abhinav N 101 K.Lal English
S003 abhinav N 102 R.L.Arora Maths
The union operation
The union operation is a binary operation that requires two relations as its
operands. It produces a third relation that contains tuples from both the
operand relations. The union operation is denoted by U. To denote the union
of two relations X and Y we will write X U Y
• One thing must be remembered about union that is both the operand
relations must be union-compatible. For a union operation A U B to be valid,
the following two conditions must be satisfied by the two operands A and B.
• The relations A and B must be of the same degree. That is, they must have
the same number of attributes.
• The domains of the ith attributes of A and the ith attribute of B must be the
same.
A B
AUB
conside r t hat we have following t wo re lat ions Drama and Song, t he n t he re sult
of SONG U DRAMA will be as shown in Fig (c)
DRAMA SONG
Roll No. Name Age Roll No. Name Age
13 Kush 15 2 Manya 15
17 Swat i 14 10 Rishabh 15
13 Kush 15