0% found this document useful (0 votes)
26 views12 pages

CS502 DBMS Unit-1 - 1692116690

The document discusses DBMS concepts and architecture. It covers topics like data, information, DBMS architecture including three schema levels, data models, database approach vs traditional file approach, advantages of database systems, and database schema. Key concepts around DBMS, data independence, data integrity, and logical data organization are explained.
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)
26 views12 pages

CS502 DBMS Unit-1 - 1692116690

The document discusses DBMS concepts and architecture. It covers topics like data, information, DBMS architecture including three schema levels, data models, database approach vs traditional file approach, advantages of database systems, and database schema. Key concepts around DBMS, data independence, data integrity, and logical data organization are explained.
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/ 12

Chameli Devi Group of Institutions

Department of Computer Science and Engineering


Database Management System
Subject Notes
UNIT-I
Syllabus
DBMS Concepts and architecture Introduction, Database approach v/s Traditional file accessing approach,
Advantages of database systems, Schemas and instances, Data independence, Database Language and
interfaces, Overall Database Structure, Functions of DBA and designer, ER data model: Entities and
attributes, Entity types, Defining the E-R diagram, Concept of Generalization, Aggregation and
Specialization. transforming ER diagram into the tables. Data models, Various other data models object
oriented data Model, Network data model, and Relational data model.

DBMS Concepts
Data:-Data is “facts or pieces of information”. Data can be defined as a representation of facts, concepts or
instructions in a formalized manner which should be suitable for communication, interpretation, or
processing by human or electronic machine.
Types of Data: Text, Numbers & Multimedia
Information: -
Information is organized or classified data which has some meaningful values for the receiver.
Information is the processed data on which decisions and actions are based.
For the decision to be meaningful, the processed data must qualify for the following characteristics:
 Timely - Information should be available when required.
 Accuracy - Information should be accurate.
 Completeness - Information should be complete.

Architecture of DBMS-
An early proposal for a standard terminology and general architecture database a system was produced in
1971 by the DBTG (Data Base Task Group) appointed by the Conference on data Systems and Languages.
The DBTG recognized the need for a two-level approach with a system view called the schema and user
view called subschema. The American National Standard Institute terminology and architecture in
1975.ANSI-SPARC recognized the need for a three-level approach with a system catalog.
There are following three levels or layers of DBMS architecture:
1. External Level
2. Conceptual Level
3. Internal Level
1. External Level: - External Level is described by a schema i.e. it consists of definition of logical records and
relationship in the external view. It also contains the method of deriving the objects in the external view
from the objects in the conceptual view.
2. Conceptual Level: - Conceptual Level represents the entire database. Conceptual schema describes the
records and relationship included in the Conceptual view. It also contains the method of deriving the
objects in the conceptual view from the objects in the internal view.
3. Internal Level: - Internal level indicates how the data will be stored and described the data structures
and access method to be used by the database. It contains the definition of stored record and method of
representing the data fields and access aid used.
A mapping between external and conceptual views gives the correspondence among the records and
relationship of the conceptual and external view. The external view is the abstraction of conceptual view
which in turns is the abstraction of internal view. It describes the contents of the database as perceived by
the user or application program of that view.
Figure 1.1 Three layers of DBMS architecture
Three-tier architecture typically comprises a presentation tier, a business or data access tier, and
a data tier. Three layers in the three-tier architecture are as follows:
1) Client layer
2) Business layer
3) Data layer

1) Client layer:
It is also called as Presentation layer which contains UI part of our application. This layer is used for the
design purpose where data is presented to the user or input is taken from the user.
Example-Designing registration form which contains text box, label, button etc
2) Business layer:
In this layer all business logic written likes validation of data, calculations, data insertion etc. This acts as an
interface between Client layer and Data Access Layer. This layer is also called the intermediate layer helps
to make communication faster between client and data layer.
3) Data layer:
In this layer, actual database is coming in the picture. Data Access Layer contains methods to connect with
database and to perform insert, update, delete, get data from database based on our input data.
Advantages
1. High performance, lightweight persistent objects
2. Scalability – Each tier can scale horizontally
3. Performance – Because the Presentation tier can cache requests, network utilization is minimized,
and the load is reduced on the Application and Data tiers.
4. High degree of flexibility in deployment platform and configuration
5. Better Re-use
6. Improve Data Integrity
7. Improved Security – Client is not direct access to database.
8. Easy to maintain and modification is bit easy, won’t affect other modules
9. In three tier architecture application performance is good.
Disadvantages
1. Increase Complexity/Effort

Database approach v/s Traditional file accessing approach


Table 1.1
Traditional File Approach Database Approach

Use separate data file for each application All Application shares a pool of related and
integrated data.
Data redundancy – independent data files Minimal data redundancy – Separate data
included a lot of duplicated data. files are integrated in to a single, logical
structure.
Same data is recorded and stored in several Each occurrence of a data item is recorded
files. only once.
Data inconsistency – several versions of the Single version of data exist
same data may exist.
Same update must be done in all Single update is required.
occurrences of same data item in each file.
Users have very little opportunity to share A database is developed to share the data
data outside of their own application. among the user who access to it
There is no centralized control for overall There is centralized control for overall data
data in different files. in database.
Data dependence – description of files, Data independence – the database system
records and data items are embedded within separates data descriptions from the
individual application programs. application programs that use the data in it
Modification to data files requires the Data structure can be modified without
programs which access that file to be changing the programs accessing the data
modified.
High program maintenance Less program maintenance
Lack of data integration – accessing data in Data are organized in to a single logical
several files are difficult structure with logical relationships defined
between associated data
Difficult to manipulation data Easy to manipulation data

Advantages of database systems


 Data Independence: Application programs should not, ideally, be exposed to details of data
representation and storage, The DBMS provides an abstract view of the data that hides such details.
 Efficient Data Access: A DBMS utilizes a variety of sophisticated techniques to store and retrieve data
efficiently. This feature is especially important if the data is stored on external storage devices.
 Data Integrity and Security: If data is always accessed through the DBMS, the DBMS can enforce
integrity constraints. For example, before inserting salary information for an employee, the DBMS can
check that the department budget is not exceeded. Also, it can enforce access controls that govern
what data is visible to different classes of users.
 Data Administration: When several users share the data, centralizing the administration of data can
offer significant improvements. Experienced professionals, who understand the nature of the data
being managed, and how different groups of users use it, can be responsible for organizing the data
representation to minimize redundancy and for fine-tuning the storage of the data to make retrieval
efficient.
 Concurrent Access and Crash Recovery: A DBMS schedules concurrent accesses to the data in such a
manner that users can think of the data as being accessed by only one user at a time. Further, the
DBMS protects users from the effects of system failures.
 Reduced Application Development Time: Clearly, the DBMS supports important functions that are
common to many applications accessing data in the DBMS. This, in conjunction with the high-level
interface to the data, facilitates quick application development. DBMS applications are also likely to be
more robust than similar stand-alone applications because many important tasks are handled by the
DBMS (and do not have to be debugged and tested in the application).
Database Schema
A database schema is the skeleton structure that represents the logical view of the entire database. It
defines how the data is organized and how the relations among them are associated. It formulates all the
constraints that are to be applied on the data.
A database schema defines its entities and the relationship among them. It contains a descriptive detail of
the database, which can be depicted by means of schema diagrams. It’s the database designers who design
the schema to help programmers understand the database and make it useful.
A database schema can be divided broadly into two categories −
Physical Database Schema − this schema pertains to the actual storage of data and its form of storage like
files, indices, etc. It defines how the data will be stored in a secondary storage.
Logical Database Schema − this schema defines all the logical constraints that need to be applied on the
data stored. It defines tables, views, and integrity constraints.

Database Instance
Database schema is the skeleton of database. It is designed when the database doesn't exist at all. Once
the database is operational, it is very difficult to make any changes to it. A database schema does not
contain any data or information.
A database instance is a state of operational database with data at any given time. It contains a snapshot of
the database. Database instances tend to change with time.

Data Independence
1. Logical data independence is the capacity to change the conceptual schema without having to change
external schemas or application programs. User change the conceptual schema to expand the database (by
adding a record type or data item), to change constraints, or to reduce the database (by removing a record
type or data item). In the last case, external schemas that refer only to the remaining data should not be
affected. Only the view definition and the mappings need to be changed in a DBMS that supports
logical data independence.
2. Physical data independence is the capacity to change the internal schema without having to change the
conceptual schema. For example, by creating additional access structures—to improve the performance of
retrieval or update. If the same data as before remains in the database, user should not have to change the
conceptual schema. Generally, physical data independence exists in most databases and file environments
where physical details such as the exact location of data on disk, and hardware details of storage encoding,
placement, compression, splitting, merging of records, and so on are hidden from the user. Applications
remain unaware of these details.

Interfaces in DBMS
A database management system (DBMS) interface is a user interface which allows for the ability to input
queries to a database without using the query language itself.
User-friendly interfaces provide by DBMS include the following:
Menu-Based Interfaces for Web Clients or Browsing- These interfaces present the user with lists of
options (called menus) that lead the user through the formation of a request.
Forms-Based Interfaces - A forms-based interface displays a form to each user. Users can fill out all of the
form entries to insert a 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.
Graphical User Interface - A GUI typically displays a schema to the user in diagrammatic form.The user
then can specify a query by manipulating the diagram.
Database Languages
Database Languages are the set of statements, that are used to define and manipulate a database. A
Database language has Data Definition Language (DDL), which is used to construct a database & it has Data
Manipulation Language (DML), which is used to access a database.
Database languages provide the tools to implement and manipulate a database. DDL and DML are not
two distinct languages but they together form a database language. The examples of database languages
are SQL, My Access, Oracle, etc.

Overall Database Structure


Database Management System(DBMS) is a software that allows access to data stored in a database and
provides an easy and effective method of -
 Defining the information.
 Storing the information.
 Manipulating the information.
 Protecting the information from system crashes or data theft.
 Differentiating access permissions for different users.
The database system is divided into three components: Query Processor, Storage Manager, and Disk
Storage.
1. Query Processor :
It interprets the requests (queries) received from end user via an application program into instructions. It
also executes the user request which is received from the DML compiler.
Query Processor contains the following components -
 DML Compiler - It processes the DML statements into low level instruction (machine language), so
that they can be executed.
 DDL Interpreter - It processes the DDL statements into a set of table containing meta data (data
about data).
 Embedded DML Pre-compiler - It processes DML statements embedded in an application program
into procedural calls.
 Query Optimizer - It executes the instruction generated by DML Compiler.
2. Storage Manager :
Storage Manager is a program that provides an interface between the data stored in the database and the
queries received. It is also known as Database Control System. It maintains the consistency and integrity of
the database by applying the constraints and executes the DCL statements. It is responsible for updating,
storing, deleting, and retrieving data in the database. It contains the following components -
 Authorization Manager - It ensures role-based access control, i.e,. checks whether the particular
person is privileged to perform the requested operation or not.
 Integrity Manager - It checks the integrity constraints when the database is modified.
 Transaction Manager - It controls concurrent access by performing the operations in a scheduled
way that it receives the transaction. Thus, it ensures that the database remains in the consistent
state before and after the execution of a transaction.
 File Manager - It manages the file space and the data structure used to represent information in
the database.
 Buffer Manager - It is responsible for cache memory and the transfer of data between the
secondary storage and main memory.
3. Disk Storage :
It contains the following components –
 Data Files - It stores the data.
 Data Dictionary - It contains the information about the structure of any database object. It is the
repository of information that governs the metadata.
 Indices - It provides faster retrieval of data item.

Functions of DBA and designer


 Maintaining all databases required for development, testing, training and production usage.
 Installation and configuration of DBMS server software and related products.
 Upgrading and patching/hot-fixing of DBMS server software and related products.
 Migrate database to another server.
 Evaluate DBMS features and DBMS related products.
 Establish and maintain sound backup and recovery policies and procedures.
 Implement and maintain database security (create and maintain logins, users and roles, assign
privileges).
 Performance tuning and health monitoring on DBMS, OS and application.
 Plan growth and changes (capacity planning).
 Do general technical troubleshooting and give consultation to development teams.
 Troubleshooting on DBMS and Operating System performance issue.
 Documentation of any implementation and changes (database changes, reference data changes
and application UI changes etc.).

Data models
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. Here, a
set of symbols and text to represent the information so that members of the organisation can
communicate and understand it. Though there are many data models being used nowadays but the
Relational model is the most widely used model.

Entity relationship model


An Entity–relationship model (ER model) describes the structure of a database with the help of a diagram,
which is known as Entity Relationship Diagram (ER Diagram). An ER model is a design or blueprint of a
database that can later be implemented as a database. The main components of E-R model are: entity set
and relationship set.
An ER diagram shows the relationship among entity sets. An entity set is a group of similar entities and
these entities can have attributes. In terms of DBMS, an entity is a table or attribute of a table in database,
so by showing relationship among tables and their attributes, ER diagram shows the complete logical
structure of a database.
In the following diagram, two entities Student and College and their relationship. The relationship between
Student and College is many to one as a college can have many students however a student cannot study
in multiple colleges at the same time. Student entity has attributes such as Stu_Id, Stu_Name & Stu_Addr
and College entity has attributes such as Col_ID & Col_Name.

Figure 1.2 ER Diagram


Here are the geometric shapes and their meaning in an E-R Diagram.
Rectangle: Represents Entity sets.
Ellipses: Attributes
Diamonds: Relationship set
Lines: They link attributes to Entity sets and Entity sets to Relationship set
Double Ellipses: Multivalued attributes
Dashed Ellipses: Derived attributes
Double Rectangles: Weak entity sets
Double Lines: Total participation of an entity in a relationship set
ER diagram has three main components:
1. Entity
2. Attribute
3. Relationship
1. Entity
An entity is an object or component of data. An entity is represented as rectangle in an ER diagram.
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the relationship with other
entity is called weak entity. The weak entity is represented by a double rectangle.
2. Attribute
An attribute describes the property of an entity. An attribute is represented as Oval in an ER diagram.
There are four types of attributes:
1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute
1. Key attribute:
A key attribute can uniquely identify an entity from an entity set. For example, student roll number can
uniquely identify a student from a set of students. Key attribute is represented by oval same as other
attributes however the text of key attribute is underlined.
2. Composite attribute:
An attribute that is a combination of other attributes is known as composite attribute. For example, In
student entity, the student address is a composite attribute as an address is composed of other attributes
such as pin code, state, country
3. Multivalued attribute:
An attribute that can hold multiple values is known as multivalued attribute. It is represented with double
ovals in an ER Diagram. For example – A person can have more than one phone numbers so the phone
number attribute is multivalued.
4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another attribute. It is represented
by dashed oval in an ER Diagram. For example – Person age is a derived attribute as it changes over time
and can be derived from another attribute (Date of birth).
3. Relationship
A relationship is represented by diamond shape in ER diagram, it shows the relationship among entities.
There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
1. One to One Relationship
When a single instance of an entity is associated with a single instance of another entity then it is called
one to one relationship. For example, a person has only one passport and a passport is given to one
person.
2. One to Many Relationship
When a single instance of an entity is associated with more than one instances of another entity then it is
called one to many relationship. For example – a customer can place many orders but a order cannot be
placed by many custome
3. Many to One Relationship
When more than one instances of an entity is associated with a single instance of another entity then it is
called many to one relationship. For example – many students can study in a single college but a student
cannot study in many colleges at the same time.
4. Many to Many Relationship
When more than one instances of an entity is associated with more than one instances of another entity
then it is called many to many relationship. For example, a can be assigned to many projects and a project
can be assigned to many students.

Generalization
 It is a bottom-up approach in which two lower level entities combine to form higher entity. In
generalization, the higher-level entity can also combine with other lower level entity to make
further higher-level entity.
 Generalization proceeds from the recognition that a number of entity sets share some common
features. On the basis of the commonalities, generalization synthesizes these entity sets into a
single, higher-level entity set.
 Generalization is used to emphasize the similarities among lower-level entity sets and to hide the
differences in the schema.

Figure 1.3 Generalization

Specialization
 It is opposite to Generalization. It is a top-down approach in which one higher level entity can be
broken down into lower level entity.
 Example: The specialization of student allows us to distinguish among students according to
whether they are Ex-Student or Current Student.
 Specialization can be repeatedly applied to refine a design schema.
Figure 1.4 Specialization

Aggregation
 One limitation of the E-R model is that it cannot express relationships among relationships. To
illustrate the need for such a construct, quaternary relationships are used which lead to
redundancy in data storage. The best way to mode such situations is to use aggregation.
 Aggregation is an abstraction through which relationships are treated as higher-level entities.
 Below is the example of aggregation relation between offer (which is binary relation between
center and course) and visitor.

Figure 1.5 Aggregation

Transforming ER diagram into the tables


The database can be represented using the notations, and these notations can be reduced to a collection
of tables. In the database, every entity set or relationship set can be represented in tabular form.
Figure 1.5 ER Diagram
There are some points for converting the ER diagram to the table:
 Entity type becomes a table.
In the given ER diagram, LECTURE, STUDENT, SUBJECT and COURSE forms individual tables.
 All single-valued attribute becomes a column for the table.
In the STUDENT entity, STUDENT_NAME and STUDENT_ID form the column of STUDENT table.
Similarly, COURSE_NAME and COURSE_ID form the column of COURSE table and so on.
 A key attribute of the entity type represented by the primary key.
In the given ER diagram, COURSE_ID, STUDENT_ID, SUBJECT_ID, and LECTURE_ID are the key attribute
of the entity.
 The multivalued attribute is represented by a separate table.
In the student table, a hobby is a multivalued attribute. So it is not possible to represent multiple
values in a single column of STUDENT table. Hence, create a table STUD_HOBBY with column name
STUDENT_ID and HOBBY. Using both the column, create a composite key.
 Composite attribute represented by components.
In the given ER diagram, student address is a composite attribute. It contains CITY, PIN, DOOR#,
STREET, and STATE. In the STUDENT table, these attributes can merge as an individual column.
 Derived attributes are not considered in the table.
In the STUDENT table, Age is the derived attribute. It can be calculated at any point of time by
calculating the difference between current date and Date of Birth.
Using these rules, user can convert the ER diagram to tables and columns and assign the mapping
between the tables. Table structure for the given ER diagram is as below:
Figure 1.6 Tables from ER Diagram

Data-model
Data models define how the logical structure of a database is modeled. Data Models are fundamental
entities to introduce abstraction in a DBMS. Data models define how data is connected to each other and
how they are processed and stored inside the system.
The very first data model could be flat data-models, where all the data used are to be kept in the same
plane. Earlier data models were not so scientific, hence they were prone to introduce lots of duplication
and update anomalies.

Object Oriented Data Model


An extension of the ER model with notions of functions, encapsulation, and object identity, as well. This
model supports a rich type system that includes structured and collection types. In Object Oriented Data
Model, data and their relationships are contained in a single structure which is referred as object in this
data model. In this, real world problems are represented as objects with different attributes. All objects
have multiple relationships between them. Basically, it is combination of Object Oriented programming
and Relational Database Model as it is clear from the following figure :
Object Oriented Data Model = Combination of Object Oriented Programming + Relational database model

Network Data Models


The network model builds on the hierarchical model by allowing many-to-many relationships between
linked records, implying multiple parent records. Based on mathematical set theory, the model is
constructed with sets of related records. Each set consists of one owner or parent record and one or more
member or child records. A record can be a member or child in multiple sets, allowing this model to convey
complex relationships.
It was most popular in the 70s after it was formally defined by the Conference on Data Systems Languages
(CODASYL).

Relational Data Models


This type of model designs the data in the form of rows and columns within a table. Thus, a relational
model uses tables for representing data and in-between relationships. Tables are also called relations. This
model was initially described by Edgar F. Codd, in 1969. The relational data model is the widely used model
which is primarily used by commercial data processing applications.
Comparison between the three types of models
Table 1.2
Compariso Network Relational Object-Oriented
n
Timeframe Late 1960’s- mid 1970’s Early 1970’s-present Late 1980’s-present
Database nd
2 Generation 3rd Generation 4th Generation
Evolution
Acronym DBMS RDBMS OODBS, ODBMS or OODBMS
Descriptio Network orientation & Relational orientation; Object orientation; active,
n navigation; uses data retrieved by distributed processing &
hierarchically-arranged unique keys; more powerful operators;
data with the exception relationships expressed uses object-oriented
that child tables can have through matching keys; programming to combine
more than one parent; physical organization of data structures with
standard interfaces data managed by functions to create re-usable
RDBMS objects
Physical Network of interrelated Data is stored in Modeling & creation of data
Structure lists; looks like several relations (tables); as objects; store objects and
trees that share branches; relationships operations to be performed
children have multiple maintained by placing a on data; applications interact
parents and parents have key field value of one with object managers which
multiple children record as an attribute work through object servers
in the related record to gain access to object
stores
Programmi Commands embedded in SQL, ODBC Java, C++, Smalltalk, Ada,
ng programming languages; Object Pascal, Objective
Languages COBOL, PL1, Fortran, ADS DRAGOON, BETA, Emerald,
Used & Assembler POOL, Eiffel, Seif, Oblog, ESP.
Loops, Visual Basic, POLKA &
Python
Examples Satellite communications, Oracle, Informix, ObjectStore, Versant, O2,
airline reservations; IDMS Ingres, Sybase, DB2, Gemstone, ONTOS, POET,
(Integrated Database MS Access, FileMaker Objectivity/DB, Jasmine,
Management System) from Pro, Visual FoxPro, SQL Matisse
Cullinet Server, MySQL (free),
PostgreSQL (free)
Status Limited usage (i.e. still used Most popular DBMS in Gaining popularity; growing
Today in satellite communications use today as a result of at a rate of 30-40% each
& airline reservation technical development year; will see mostly in new
systems) efforts to ensure that development
advances such as object
orientation, web
serving, etc. appear
quickly & reliably

You might also like