Professional Documents
Culture Documents
Unit 1 DBMS
Unit 1 DBMS
Unit 1 DBMS
UNIT 1
Lecture 1 – Introduction to DBMS
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering and Research,
Prayagraj
Syllabus
Unit-I:
Introduction: Overview, Database System vs File System, Database
System Concept and Architecture, Data Model Schema and In-
stances, Data Independence and Database Language and Interfaces,
Data Definitions Language, DML, Overall Database Structure. Data
Modeling Using the Entity Relationship Model: ER Model Concepts,
Notation for ER Diagram, Mapping Constraints, Keys, Concepts of
Super Key, Candidate Key, Primary Key, Generalization, Aggrega- tion,
Reduction of an ER Diagrams to Tables, Extended ER Model,
Relationship of Higher Degree.
1
2
UNIT 1-AKTU Syllabus
Introduction: Overview.
Database System vs File System.
Database System Concept and Architecture.
Data Model Schema and Instances.
Data Independence and Database Language and Interfaces.
Data Definitions Language(DDL), Data Manipulation Language(DML).
Overall Database Structure.
Data Modelling Using the Entity Relationship Model: ER Model Concepts.
Notation for ER Diagram.
Mapping Constraints.
Keys, Concepts of Super Key, Candidate Key, Primary Key.
Generalization, Aggregation.
Reduction of an ER Diagrams to Tables.
Extended ER Model, Relationship of Higher Degree. 3
COURSE OUTCOME(CO1) -
4
LECTURE OUTLINE-
Introduction
Database Management System
Applications of DBMS
Characteristics of DBMS
Advantages / Disadvantages of DBMS
Actors on the scene
Workers Behind the scene
DBMS vs Traditional File System
AKTU Questions
Placement Questions
5
INTRODUCTION-
Database:
The database is a collection of inter-related data which is used to
retrieve, insert and delete the data efficiently. It is also used to organize
the data in the form of a table, schema, views, and reports, etc.
For example: The college Database organizes the data about the admin,
staff, students and faculty etc.
Using the database, you can easily retrieve, insert, and delete the
information.
6
DATABASE MANAGEMENT SYSTEM-
Database Management System-
Ex – MySQL, Oracle 7
Defining – It involves specifying the datatypes structures &
constraints of the data to be stored in the database. Database
definition or descriptive information is also stored in the database
in the form of a database catalogue or dictionary, it is called Meta
Data.
Constructing – Constructing the database is the process of storing
the data on some storage medium that is controlled by the DBMS.
Manipulating – manipulating a database include functions such as
Querying the database to retrieve specific data, updating the
database to reflect changes in the mini -world and generating
reports form the data.
Sharing – Sharing a database allows multiple users and programs to
access the database simultaneously.
8
APPLICATIONS OF DBMS-
9
CHARACTERISTICS OF DBMS -
Self
Multiple
Describing Insulation
Views
Nature
Backup and
Data sharing
Recovery
10
CHARACTERISTICS OF DBMS -
Self Describing nature of a database system –
Database system contains not only the database itself but also
a complete definition or description of the database structure
and constraints.
13
CHARACTERISTICS OF DBMS -
Sharing of Data & Multiuser Transaction Processing –
14
CHARACTERISTICS OF DBMS -
Backup and Recovery -
At that time no one will be able to get the database back and for
sure company will be in a big loss.
15
ADVANTAGES OF DBMS -
Controls database redundancy: It can control data redundancy because it stores
all the data in one single database file and that recorded data is placed in the
database.
Data sharing: In DBMS, the authorized users of an organization can share the data
among multiple users.
Easily Maintenance: It can be easily maintainable due to the centralized nature of
the database system.
Reduce time: It reduces development time and maintenance need.
Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and software failures and restores the data if
required.
Multiple user interface: It provides different types of user interfaces like graphical
user interfaces, application program interfaces.
16
DISADVANTAGES OF DBMS -
Cost of Hardware and Software – It requires a high speed of data processor and
large memory size to run DBMS software.
Size – It occupies a large space of disks and large memory to run them efficiently.
17
ACTORS ON THE SCENE-
19
DATABASE DESIGNERS-
Database designers are responsible for identifying the data to be stored in the
database and for choosing appropriate structures to represent and store this data.
These tasks are mostly undertaken before the database is actually implemented &
populated with data.
It typically interact with each potential group of users and develop views of the
database that meet the data & processing requirements of these20 groups.
END USERS -
People whose jobs require access to the database for
Querying,
Updating and
generating reports the database primarily exists for their use.
Four types of End Users
Casual End Users
Naïve Or parametric End Users
Sophisticated End Users
Stand Alone End Users
21
Types of End Users -
Casual End Users –
Occasionally access the database, but they may need different
information each time.
Use a sophisticated database Query Language.
• Naïve Or Parametric End Users-
Make up a sizable portion of database end users.
Main job functions revolves around constantly Querying & updating the
databases , using standard types of queries & updates called Canned
Transactions.
22
Types of End Users -
Sophisticated End Users –
Include Engineers , business analysts and others who thoroughly
familiarize themselves with the facilities of the DBMS.
23
SYSTEM ANALYSTS AND PROGRAMMERS-
24
WORKERS BEHIND THE SCENE -
They are those who work to maintain the database system environment but
who are not actively interested in the database itself.
Workers behind
the Scene
Gives an abstract view of data that hides the Provide the detail of data representation and
details. storage of data
Takes care of concurrent access of data using Concurrent access has many problems like
some form of locking. redirecting some information or updating
some.
28
AKTU Questions-
Write the disadvantages of file system. Explain how these disadvantages can
overcome in database management system.
Describe the different types of database users and their responsibilities over
the DBMS.
Who are database administrators? What are the functions of DBA?
29
Placement Questions-
30
THANK YOU
Database Management System
KCS 501
Computer Science V Sem
Lecture 2- Database System Concept and
Architecture
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering
and Research, Prayagraj
DBMS Architecture-
Works
Employee Project
on
Employee_ Project
Employee_id Project_id
name Budget
Relational Model
1-tier architecture
2-tier architecture
3-tier architecture.
1 Tier Architecture -
In this architecture, the database is directly available to the
user. It means the user can directly sit on the DBMS and uses it.
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering and Research, Prayagraj
UNIT 1-AKTU Syllabus
Introduction: Overview.
Database System vs File System.
Database System Concept and Architecture.
Data Model Schema and Instances.
Data Independence and Database Language and Interfaces.
Data Definitions Language(DDL), Data Manipulation Language(DML).
Overall Database Structure.
Data Modelling Using the Entity Relationship Model: ER Model Concepts.
Notation for ER Diagram.
Mapping Constraints.
Keys, Concepts of Super Key, Candidate Key, Primary Key.
Generalization, Aggregation.
Reduction of an ER Diagrams to Tables.
Extended ER Model, Relationship of Higher Degree.
23-09-2023 2
COURSE OUTCOME(CO1)-
23-09-2023 3
LECTURE OUTLINE (CO1)
DBMS Languages
Data definition Languages
Data Manipulation Languages
Data Control Languages
Transaction Control languages
DBMS Interfaces
AKTU Questions
Placement Questions
23-09-2023 4
DBMS Languages -
DBMS
Languages
23-09-2023 5
Data Definition Language (DDL) -
• Using the DDL statements, you can create the skeleton of the
database.
23-09-2023 7
Data Manipulation Language(DML)-
DML stands for Data Manipulation Language. It is used for accessing and
manipulating data in a database. It handles user requests.
Here are some tasks that come under DDL:
• Select: It is used to retrieve data from a database.
• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
• Merge: It performs UPSERT operation, i.e., insert or update operations.
• Call: It is used to call a structured query language or a Java subprogram.
• Explain Plan: It has the parameter of explaining data.
• Lock Table: It controls concurrency.
23-09-2023 8
Data Control Language (DCL)
• DCL stands for Data Control Language. It is used to retrieve the stored
or saved data.
• The DCL execution is transactional. It also has rollback parameters.
(But in Oracle database, the execution of data control language does
not have the feature of rolling back.)
TCL is used to run the changes made by the DML statement. TCL
can be grouped into a logical transaction.
23-09-2023 13
MENU BASED INTERFACES -
These interfaces present the user with lists of options (called
menus) that lead the user through the formation of a request.
Pull-down menus are a very popular technique in Web based
interfaces.
They are also often used in browsing interface which allow a user
to look through the contents of a database in an exploratory and
unstructured manner.
23-09-2023 14
FORMS BASES INTERFACES-
A forms-based interface displays a form to each user.
Users can fill out all of the form entries to insert new data, or
they can fill out only certain entries, in which case the DBMS
will redeem same type of data for other remaining entries.
Forms are usually designed or created and programmed for
the users.
Many DBMSs have forms specification languages which are
special languages that help specify such forms.
23-09-2023 15
Example: SQL* Forms is a form-based language that specifies
queries using a form designed in conjunction with the relational
database schema.
23-09-2023 16
GRAPHICAL USER INTERFACES-
A GUI typically displays a schema to the user in
diagrammatic form.
23-09-2023 19
SPEECH INPUT AND OUTPUT INTERFACES –
23-09-2023 20
INTERFACES FOR PARAMETRIC USERS-
23-09-2023 22
AKTU QUESTIONS-
Identify various types if DBMS Languages an list their applications.(2017-18)
Describe the classification of database Language. Which type of language is SQL?
Clearly explain the DDL, DML with suitable examples.(2013-14)
Explain DBMS interfaces,
23-09-2023 23
Database Management System
Lecture 4- Overall Database Structure
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering and Research, Prayagraj
DATABASE STRUCTURE -
1
Database System Structure
Storage Manager
2
Database System Structure
Storage Manager(cont.)
Storage Manager(cont.)
4
Database System Structure
Query Processor
6
Database Management System
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering and Research, Prayagraj
ENTITIES -
It is the basic object which is a thing in the real world
with an independent existence.
An entity may be an object with a physical existence
(ex – Person, Car , House , Employee etc.)
It may be an object with a conceptual existence.( ex-
A Company, A job, A university course)
Entity is represented as
ATTRIBUTES -
Composite attributes are those attributes which are composed of many other simple
attributes.
Ex. Address is composed of Street, City, Country, State
SINGLE VALUED ATTRIBUTE -
The attribute that has only one value for the particular entity is
called Single Value Attribute.
Ex- Age Attribute
MULTI VALUED ATTRIBUTE -
• The attribute that can have more than one value for a
particular Entity.
• Ex- Colour Attribute of Vehicle.
• Ex- College Degrees Attribute
of person.
DERIVED ATTRIBUTES -
ENTITY SET-
• An Entity is an object of Entity Type and a set of all entities
is called an entity set. For Example, E1 is an entity having
Entity Type Student and the set of all students is called
Entity Set. In ER diagram, Entity Type is represented as:
• An entity type describes the schema or Intension for a set of
entities that share the same structure.
• The collection of a particular entity type is grouped into
entity set , which is also called the Extension of the Entity
Type.
Types of Entity
1. Strong Entity
A Strong Entity is a type of entity that has a key Attribute. Strong Entity does
not depend on other Entity in the Schema. It has a primary key, that helps in
identifying it uniquely, and it is represented by a rectangle. These are called
Strong Entity Types.
2. Weak Entity
An Entity type has a key attribute that uniquely identifies each entity in the
entity set. But some entity type exists for which key attributes can’t be
defined. These are called Weak Entity types.
Role names signifies the role that participating entity from the
entity type plays in each relationship instance and helps to
explain what the relationship means.
In such cases the role name becomes essential for distinguishing the meaning of each participation.
Cardinality Ratio
Participation Ratio
CARDINALITY RATIO -
Cardinality defines the number of entities in one entity set, which can
be associated with the number of entities of other set via relationship
set.
Work
Employee Project
s on
Many to One Relationship (M:1) Type-
In this type of cardinality mapping, an entity in A is
connected to at most one entity in B. Or we can say a
unit or item in B can be associated with any number
(zero or more) of entities or items in A.
Many to One Relationship (M:1) Type-
Example:
In a particular hospital, multiple surgeries are done by a single surgeon.
Such a type of relationship is known as a many-to-many relationship.
PARTICIPATION CONSTRAINTS -
The participation constraint specifies whether the existence of an
entity depends on its being related to another entity via the
relationship type.
Branch
Case Study 3 (ER diagram)
Assume in a university
• There are multiple libraries and each library has multiple student
members
• Students can become members to multiple libraries by paying
appropriate
membership fee
• Each library has its own set of books. Within the library these books
are
identified by a unique number
• Students can borrow multiple books from subscribed library
• Students can order books using inter-library loan. This can be
useful if a student wishes to borrow books from a library where s/ he
is not a member. The student orders the books through a library
where s/ he is a member
Step 1: Generally the entities will have multiple instances in a given business
scenario. As per this guideline, we can identify the following entities:
1. LIBRARY
2. BOOK
3. STUDENT
Book
Database Management System KCS
501
Computer Science V Sem
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering and Research, Prayagraj
STRONG ENTITY TYPE -
A strong entity is complete by itself and is not dependent on any
other entity type.
It possess a primary key which describes each instance in the
strong entity set uniquely.
That means any element in the strong entity set can be uniquely
identified.
A Strong entity is represented by square with a single line.
STRONG ENTITY TYPE -
WEAK ENTITY TYPE-
A weak entity cannot be used independently as it is dependent
on a strong entity type known as its owner entity.
Also, the relationship that connects the weak entity to its owner
identity is called the identifying relationship.
So the primary key will be composed of all three attributes, namely Emp_ID,
Emp_role, and Proj_ID in combination.
So these attributes act as a composite key since the primary key comprises
more than one attribute.
COMPOSITE KEY-
ARTIFICIAL KEY-
The key created using arbitrarily assigned data are known as artificial
keys.
These keys are created when a primary key is large and complex and has
no relationship with many other relations.
The data values of the artificial keys are usually numbered in a serial
order.
For example, The Primary Key, which is composed of Emp_ID, Emp_role, and
Proj_ID, is large in employee relations.
Database Management System KCS
501
Computer Science V Sem
Dr Shruti Bharadwaj
Assistant Professor
United College Of Engineering and Research, Prayagraj
Reduction of an E-R Schema to Tables
Every E-R schema or diagram can be converted into set of tables. In this
section, we describe how an E-R schema can be represented by tables.
The constraints specified in an E-R diagram, such as primary keys and
cardinality constraints, are mapped to constraints on the tables
generated from the E-R diagram.
Rule-01: For Strong Entity Set With Only Simple Attributes-
Strong entity set with only simple attributes will require only one table in
relational model.
•Attributes of the table will be the attributes of the entity set.
•The primary key of the table will be the key attribute of the entity set.
Example:
1
Rule-02: For Strong Entity Set With Composite Attributes-
4
Rule-03: For Strong Entity Set With Multi Valued Attributes-
5
Example:
Roll_no City
Mobile
Roll_no
_no
6
Rule-04: Translating Relationship Set into a Table-
If we consider the overall ER diagram, three tables will be required in relational model-
•One table for the entity set “Employee”
•One table for the entity set “Department”
•One table for the relationship set “Works in”
Rule-05: For Binary Relationships With Cardinality Ratios-
8
Case-01: For Binary Relationship With Cardinality Ratio m:n
8
Case-02: For Binary Relationship With Cardinality Ratio 1:n
8
Case-03: For Binary Relationship With Cardinality Ratio m:1
8
Case-04: For Binary Relationship With Cardinality Ratio 1:1
Here, two tables will be required. Either combine ‘R’ with ‘A’ or ‘B’
Way-01:
1.AR ( a1 , a2 , b1 )
2.B ( b1 , b2 )
Way-02:
1.A ( a1 , a2 )
2.BR ( a1 , b1 , b2 )
8
Rule-06: For Binary Relationship With Both Cardinality
Constraints and Participation Constraints-
Rule: Strong entity set can be directly converted (b) SUBJECT (b) SUBJECT (Subject_ID, Subject_Name, Teacher)
into table.
(c) CLASS (C) CLASS (Class_ID, Class_Name)
Composite attribute Address in STUDENT table STUDENT (Student_ID, Student_Name, DOB, Door, Street, City, Pin)
1-1, 1-n, and n-1 Relationships Attends (1-1 from STUDENT to CLASS) CLASS (Class_ID, Class_Name, Student_ID)
Rule: Include the primary key of one side entity Studies (1-n from STUDENT to SUBJECT) SUBJECT (Subject_ID, Subject_Name, Teacher, Student_ID)
set as the foreign key of other side entity set.
Descriptive attribute DateOfJoin, Hours# of Attends relationship. CLASS (Class_ID, Class_Name, Student_ID, DateOfJoin, Hours#)
Question-1(a)
Construct an E-R diagram for a car-insurance company whose cus- tomers own
one or more cars each. Each car has associated with it zero to any number of
recorded accidents.
Exercise
Solution An E-R diagram for a car-insurance company is
the following:-
Exercise
Question-1(b)
Question-2(a)
Question-2(b)
Dr Shruti Bharadwaj
Assistant Professor
Department of CSE
United College of Engg. and Research, Prayagraj, India
Aggregation
• Aggregation is an abstraction through which relationships are
treated as a higher level entity sets and can participate in
relationships.
• Aggregation allows us to indicate that a relationship set
participates in another relationship sets.
Extended E-R Features