0% found this document useful (0 votes)
6 views84 pages

Unit 1

The document provides an overview of Database Management Systems (DBMS), highlighting the drawbacks of traditional file systems and the advantages of using DBMS for data management. It covers basic terminology, classification criteria, historical development, architecture, and components of DBMS, including data models and languages. Additionally, it discusses the roles of database administrators and the structure of DBMS, emphasizing the importance of data independence and integrity.

Uploaded by

nikhilprataps111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views84 pages

Unit 1

The document provides an overview of Database Management Systems (DBMS), highlighting the drawbacks of traditional file systems and the advantages of using DBMS for data management. It covers basic terminology, classification criteria, historical development, architecture, and components of DBMS, including data models and languages. Additionally, it discusses the roles of database administrators and the structure of DBMS, emphasizing the importance of data independence and integrity.

Uploaded by

nikhilprataps111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Unit – 1

Data Base Management System (KCS-501)


Introduction
Drawbacks of using file systems to store data

■ Data and Application Dependence

■ Data redundancy and inconsistency


(Multiple file formats & duplication of information in different
files)

■ Difficulty in accessing data


(Need to write a new program to carry out each new task)

■ Data isolation — multiple files and format


2
Drawbacks of using file systems to store data (Cont.)

■ Integrity problems - Integrity constraints

■ Updates Problem

■ Concurrent access by multiple users

■ Security problems

Database system is the solutions regarding the above problems

3
Basic Terminology of Database
■ Field – A character or group of characters (alphanumeric or numeric)
that has a specific meaning
■ Record – A set of one or more logically related fields
■ File – A set of related records

■ Information- The Combination of data (Raw facts) and knowledge


Data + Knowledge = Information

Input
Application
Data file
program
Output
Frontend Tools Backend Tools 4
Database Management System

DBMS is the combination of two words

Database + Management System = DBMS

DBMS is a software designed to assist in maintaining and


utilizing large collection of data

DBMS software can be used to set up the database and


manage the data for updating and retrieval from database
as per our requirements
5
Database Management System
■ Database :
■ is a collection of data, typically describing the activities of
one or more related organizations
■ is a collection of logically related files
■ a collection of data and information describing items of
interest to an organization

■ Management System :
Management system is a collection of programs that enables
users to create and maintain the database
6
DBMS Application
■ Banking : Transactions

■ Airlines: Reservations and Schedules

■ Universities: Registration, Result and other information

■ Sales: Customers, Products and Purchases

■ Manufacturing: Production, Processing, Inventory etc


■ .
■ Human Resources: Employee records, salaries and tax etc.
7
DBMS Classification Criteria
■ Number of supported users
■ Database site location
■ Type of database use and Data Model

■ Single-user DBMS:
■ On PC – Desktop database

■ Multi-user DBMS:
■ Workgroup database (<50 users)

■ Enterprise database (> 50 users)


8
DBMS History
■ 1950s - 1960s:
■ Data processing using magnetic tapes for storage and punched cards for
input

■ 1960s - 1970s:
■ Hard disks allow direct access to data
■ Network and Hierarchical data models in general use
■ Dr. Codd (IBM) introduced the relational data model in 1970
■ High-performance (for the era) transaction processing

■ 1980s:
■ Structure Query Language (SQL)

■ Parallel and distributed database systems


■ Object-oriented database systems 9
DBMS History
■ 1990s:
■ Large decision support and data-mining applications
■ Large multi-terabyte data warehouses
■ Emergence of Web commerce

■ 2000s +:
■ XML and XQuery standards
■ Automated database administration
■ Increasing use of highly parallel database systems
■ Data Mining and Data Warehousing

10
Database Schema and Instances
A database model has two main components:
- Description
- Database itself

The description of database is called the Database Schema


or Database Structure which is specified during database
design and generally it is not change frequently.

A correct schema to the DBMS is extremely important and the


schema must be designed with care.

11
Database Schema and Instances

The data in the database at a particular moment in times is


called a Instances or records. We may insert or delete a
record or change the value of data item in record.

A single entry in a table is called a Tuple or Record or Row. A


tuple in a table represents a set of related data.

The actual data in database may change quite frequently.

12
Database Schema and Instances

Example : Student Table


(s_id: char(4), s_name: char(20), branch : char(5), r_no: integer, remark:char(10))

Database Schema or Database Structure

S_id S_name Branch R_no Remarks


Tuple or Record or Row
1001 Ram IT 3
1002 Shyam CSE 2
1003 Nitin TT 2

Instances or records

13
Database Architecture
Database Architecture uses programming languages to design a
particular type of software for businesses or organizations.

Database Architecture focuses on the design, development,


implementation and maintenance of computer programs that store
and organize information for businesses, agencies and institutions.

To understand the structure of DBMS, they are classified into


three types based on their build architecture:

•One-Tier Architecture.
•Two-Tier Architecture.
•Three-Tier Architecture.
14
Database Architecture

15
Levels of Abstraction in a DBMS

A Database Management system (DBMS) provides three


levels of abstraction of Three-Schema Architecture.

- External Schema (User View)

- Conceptual Schema (Data Structure Design)

- Physical Schema (Physical Table)

16
Levels of Abstraction in a DBMS
External Schema External Schema External Schema
1 2 3

Conceptual Database structure/


(logical) Schema
Schema

Physical Database
Schema

Secondary HDD/CD ROM/etc.


Storage 17
Physical Schema
■ The physical schema specifies storage details.

■ The physical schema summarizes how the relation described


in the conceptual schema are actually stored on secondary
storage device such as disks and tapes.

■ The physical schema is also responsible for storing all


relations as unsorted files and creating an index to speed up
data retrieval operation.

18
Conceptual (Logical) Schema
■ The conceptual schema describes the stored data in terms of
the data model of the DBMS.

■ In a relation DBMS, the conceptual schema describes all


relation that are stored in the database.

■ It describes all records and relationships included in the


conceptual view and therefore, in the database,.

19
Conceptual (Logical) Schema
Example: Book table
(bid: char(2), title: char(50), author: char(20), price:
decimal(5,2), av_q: integer)

Example :Customer table


(cid: char(2), l_n: char(25), f_n: char(25), a_c: char(30),
phone: char(10))

20
External Schema
■ The external schema consists of the definition of the
logical records and the relationships in the external view

■ Each external schema contains of a collection of one or


more views and relations from the conceptual schema

■ A view is conceptually a relation, but records in view are


not stored in the DBMS.

■ Reduce complexity of DBMS for users

■ Support data security 21


Data Independence
■ Data Independence is achieved through use of the three
levels of data abstraction

■ Data Independence can be define as the capacity to


change the schema at one level of a database system
without having to change the schema at the next higher
level

■ We can define two type of data independence


■ Logical Data Independence
■ Physical Data Independence

22
Data Independence
External Schema External Schema External Schema
1 2 3

Logical data Independence


Conceptual
Schema

Physical data Physical Independence


Schema

Secondary
Storage 23
Logical Data Independence
■ Logical data independence is the capacity to change
the conceptual schema with out having to change
external schemas or application programs

■ EX. We may change conceptual schema to expand the


database by adding a records or reduce the database by
removing a record

■ Ex. Logical data independence also provides to change


the constraints in conceptual schema without affecting
external schemas or application programs
24
Physical Data Independence
■ Physical data independence is the capacity to
change the physical schema without having to
change the conceptual or external schemas.

■ Change in physical storage of the data

25
DBMS Components
■ Data Model

■ Data Dictionary (System Catalog)


■ Meta data

■ Database languages
■ Data Definition language (DML)
■ Data Manipulation language (DDL)

26
Data Model
■ Data Model gives us an idea that how the final system will
look like after its complete implementation. It defines the
data elements and the relationships between the data
elements. Data Models are used to show how data is
stored, connected, accessed and updated in the
database management system.

■ There are three types of data models:


■ Hierarchical Model,

■ Network Model,

■ Relational Model.

■ These models have further categories which are used


according to a different use case.
27
Hierarchical Database Model
■ The hierarchal model based on two data structuring concepts:
■ Records
■ Parent-Child relationship

■ A record represents one or a few fields

■ IBM developed the Information Management System


(MIS)-DBMS.

28
Hierarchical Database Model

■ A parent-child relationship is a 1:N relationship between two


record types

■ A child segment has only one parent

■ A segment with no parent is called the “root”

■ A segment with no children is called a “leaf”

■ A segment called “parent” may have several subordinate


segments called “children” and ordered from left to right
29
Advantages of Hierarchical Database Model

■ Conceptual simplicity

■ Efficiently describes large volume of data with


1:N relationships which are fixed over time

■ All advantages associated with DBMS

30
Network Database Model
There are two basic data structure in the network model:
■ Records
■ Sets

■ Data is stored in records and each record consists of group of


related data.

■ A typical database application has various records.

■ Network model provide a construct called set type to represent


relation between these records

31
Network Database Model
■ In network model terminology, a relationship is called a set.

■ Each set is composed of at least two records.

■ The difference between the hierarchical and the network


model is that the network model might include a condition
in which a member can appear as member in more than
one set.

■ In other words, a member may have several owners.

■ A set represents a 1:M relationship between the owner and


the member 32
Network Data Manipulation
■ Locate a specific record given a value of some of its fields

■ Create, delete, update a records.

■ Move from child to parent within in some link

■ Move from a parents to its first child in some link

33
Advantages of Network DBMSs

■ Conceptual simplicity

■ The M:N relationships are easier to implement in the network


database model

■ Data access flexibility is superior

■ All advantages associated with DBMSs

■ Conformance to standards

34
Disadvantages of Hierarchical
and Network DBMSs
■ Complex implementation
■ Complex data manipulation
■ Lack of data independence
■ Lack of standards (hierarchical model)
■ No widely accepted theoretical foundations
for the models

35
Relational Data Model
■ Commercial products appeared in the late 70s - earlier 80s

■ SQL – standard data management language for relational


DBMSs

■ Data manipulation is supported by theory of sets, relational


algebra and calculus

36
Relational Data Model
■ Basic constructs:
■ A relation
■ A record
■ A field (or a column)

■ Integrity constraints

■ Supports all types of relationships between two


records which may change over time:
■ 1:1 (one-to-one)
■ 1:N (one-to-many)
■ N:M (many-to-many)
37
Relational Data Model
■ Before 1970 most the database system were based on two models
i.e. Hierarchical Model or Network Model

■ Dr. Codd (IBM Scientist) proposed a relational Data Model in 1970.

■ A RDBMS is a Database Management system which is based on relational model as


introduced by Dr. Codd. It should satisfy Codd 12 rules but in practice there is no
DBMS that satisfies all these rules.
■ Today, popular RDBMS are:

■ Microsoft Access
■ MSSQL
■ MYSQL
■ Oracle
■ Sybase
■ DB2
■ Informix 38
Relational Algebra
■ Relational Algebra is a procedural query language. It consists of
set of operations that take one or two relations as input and
produce a new relation as their result.
■ Relational Algebra is of following eight types:
1. Select (σ )
2. Project (Π )
3. Product (X)
4. Unions (U)
5. Differences (- )
6. Intersection (∩ )
7. Join ( )
8. Divide/ Division ( / )
Data Dictionary
A Data Dictionary is a collection of names, definitions,
and attributes about data elements that are being
used or captured in a database, information system, or
part of a project.

A Data Dictionary also provides metadata about data


elements.

40
Database Language
■ A language is needed to describe the database to the DBMS
as well provide facilities for changing the database and
physical data structure.

■ The two languages are the part of database language


■ Extended Host Language – These are subroutine calls from
one or more programming languages and used to interact
with database (Ex. Visual Basic, Dot Net etc.)

■ Query Language – These are special purpose language


that usually provide more powerful to interact with
database and non programmers may be easily use. These
are categorized in two type:
■ Data Definition Language (DDL)
■ Data Manipulation Language (DML) 41
Data Definition Language (DDL)
Data Definition Language (DDL) can be used to define the
conceptual schemas and also give some details about how to
implement this schema in physical devices used to store data.

DDL is used by the DBA by database designer to define both


schemas

The basic function of DDL include following:

■ Creation of data structure supported by data modal (CREATE TABLE)


■ Modification of data structure (ALTER TABLE)
■ Deletion of data structure (DROP TABLE)
■ Creation of indexes on particular data items for data access (CREATE
INDEX) 42
Data Manipulation Language (DML)
Data Manipulation Language (DML) that enables users to
access or manipulate as organized by the appropriate data
model

DML provides commands to select and retrieve data from the


database designer to define both schemas

The basic function of DML include following:


■ Retrieval data (SELECT operator for relational model)
■ Modification of data (UPDATE operator)

■ Deletion of data (DELETE operator)

■ Creation of new data (INSERT operator)

■ Most DML have built in function (SUM, COUNT and AVG etc.)
43
Difference between DBMS and RDBMS

44
Database Administrators (DBA)
■ Database administrators (DBAs) use specialized Data
base software to store and organize the data.

■ The role of DBAs are :

■ Capacity planning,
■ Installation and Configuration,
■ Database Design,
■ Performance Monitoring,
■ Security and troubleshooting,
■ Authentication or Privilege
■ Backup and Data Recovery. 45
Structure of DBMS
Query evaluation Engine

Concurrency File and Access Methods


Control

Transaction Buffer Manager Recovery


Manager Manager
Lock
Manager Disk space Manager

Database
Index Files
Data Dictionary
Data Files
46
Entity Relationship Model (ER Model )
■ 1976 proposed by Peter Chen

■ ER diagram is widely used in database design

■ Represent conceptual level of a database system

■ ER model consists of a collection of basic object,


called entities and relation among these object

47
Basic Concepts
■ Entity - The entity is a thing or object in the world that has some independent existence with
some properties that make it differs from other. In other words entity is something that has on
identity

■ Entity set – An Entity set is a set of entities of the same type that share the same properties
or attributes. An entity set contains many entities Ex. CAR (MAURTI , TATA, etc. )

■ Weak Entity Set- An entity set which does not have a primary key

■ Strong Entity Set- An entity set which have a primary key

■ Attributes - common properties of the entities in a entity sets


Ex. Car no., Car Color, Car Year, Car Model etc.

■ Relationship – specify the relations among entities from two or more entity sets

■ Domain - The Domain of an attributes is the collection of all possible values, an attribute can
48
have.
Notations of ER Diagram

49
Notations of ER Diagram

50
Example : ER Model

51
Example : ER Diagram with Weak & Storing Entity Set

52
Relationship
■ A relationship may be thought as a set as well
■ For binary relationship, it enumerates the pairs of
entities that relate to each other

■ For example, entity set M = {Mike, Jack, Tom}


entity set F = {Mary, Kate}. The relationship set
married between M and F may be
{<Mike,Mary>,<Tom, Kate>}

53
Relationship Example

54
Attribute of A Relationship Set

55
Relationship
• The degree of a relationship = the number of
entity sets that participate in the relationship
– Mostly binary relationships
– Sometimes more
• Mapping cardinality of a relationship
– 1 –1
– 1 – many
– many – 1
– Many-many

56
One-One and One-Many

57
Many-one and many-many

58
1- many

One customer and many loan facilities

59
Many - 1

Many customers and one loan facility

60
Many - many

Many customers and many loan facilities

Ex. ER Diagram corresponding to customer and loan

61
Total Participation
When we require all entities to participate in the relationship
(total participation), we use double lines to specify

Every loan has to have at least one customer

62
Self Relationship
■ Sometimes entities in a entity set may relate to other
entities in the same set. Thus self relationship
■ Here employees mange some other employees
■ The labels “manger” and “worker” are called roles the
self relationship

63
More examples on self-relationship
■ People to people
■ Parent – Children
■ Manager – Employee
■ Husband – Wife

■ Word to word
■ Root – Synonym

64
Type of Attributes
■ Single Value Attributes (Single Ellipse)
Ex. Student Roll No.

■ Multi-Valued Attributes (Double Ellipse)


Ex. Phone No.

■ Derive Attributes (Dashed Ellipse)


Ex. Age derived from Date of Birth

■ Composite Attributes (Single Ellipse)


Ex. Name (First Name, Middle Name & Last Name) 65
Ex. ER Diagram with Composite, Multi-valued and Derived Attributes

66
Ex. ER Diagram for Entity with Attribute

67
Ex. ER Diagram for Student and Faculty

68
Ex. ER Diagram for Customer, order and Product

69
Keys
A Key is a value which can always used to unique identification
an object instance
Student Table
Roll No Name Branch Semester Remarks
1001 Ram IT 3
1002 Shyam CSE 2
1003 Nitin TT 2
A Super key is a set of one or more attributes that taken collectively
allow us to identify uniquely an entity in the entity set.
Ex. Supper Key, S=(Roll No, Name, Branch)
S=(Name , Branch, Semester)
A Candidate key can be defined as the minimum number of super key
that identifies the record uniquely. 70
Keys
■ A Primary key can be defined as the minimum number
of candidate key that is chosen by the database designer
as the principal means of identifying entities within an
entity set. There should not be any duplicate in the record
of primary key.
Ex. Primary Key, P=(Roll No)

■ A Foreign key is a column whose values are the same as


the primary key of another table. The relationship is made
between two relational table by matching the value of the
foreign key in one table with the values of the primary
key in another 71
Key Examples
■ Suggest super keys for the following entity?
■ What are the candidate keys?
■ Primary key?

Author

name death

birthday description

72
Generalization
■ Generalization is a relationship that exists between a
high-level entity set and lower-level entity set.

■ Generalization is represent by triangle component labeled ISA.

■ The label ISA stands for “is a”

ISA

73
Example of Generalization
■ A person is a high-level entity set and customer
and employee are lower-level entity set .

■ The person entity set is the superclass and


customer & Employee are subclass.

■ The ISA relationship may be referred as a


superclass-subclass relationship

74
Fig. Generalizing Car and Truck Entities

75
Specialization Inheritance and Attribute Inheritance
■ The process of designing sub groupings with an entity set is called
specialization.

■ A lower-level entity set inherits all the attributes and relationship


participation of the higher-level entity set to which it is linked.

■ A lower-level entity set may have additional attributes and


participate in additional relationships

■ Attribute Inheritance: A Crucial property of the higher and lower


level entities created by specialization and generalization is attribute
inheritance. The attributes of the higher level entity sets are said to
be inherited by the lower level entity sets.
(Ex. Customer and Employee inherit the attributes of person)
76
Fig. ER diagram with Generalization and Specialization

Generalization

Specialization

77
Aggregation
■ Aggregation is a technique to express relationship
among relationship.

■ Through E-R modeling we cannot express


relationship among relationships. Thus we use the
concept of aggregation for this purpose.

■ Aggregation is an abstraction through which


relationships are treated as entities
78
Fig. ER diagram with Aggregation

79
Extended ER Model
■ The Extended Entity Relationship Model (EER) model
include all the modeling concepts of the ER model and
the concepts of specialization , generalization,
higher-level and lower-level entity set attributes
inheritance and aggregation.

80
Relationship Degree
• The degree of a relationship type is the number of participating
entities in relation.

• A relationship type of degree two is called binary relationship.

• A relationship type of degree three is called ternary


relationship.

• If there is a relationship that involves N entities called N-array


relationship.

81
Fig. Binary and Ternary Relationship

82
Ex. Reduction of ER diagram to Table

83
Ex. Reduction of ER diagram to Table

84

You might also like