CST204 Module 1 DBMS
CST204 Module 1 DBMS
Data: known facts that can be recorded and that have implicit meaning.
o Eg: Text- names, telephone nos, address,
o Image, Video, audio etc
o Flipkart, Amazon, Uber etc contains data
:
Database Collection of related data
These are data but not database since they are not related data
Type of Database
Tradi onal Database: informa on is stored and accessed is either textual or numeric.
Mul media databases: store images, audio clips, and video streams digitally
Geographic informa on systems (GIS) : store and analyze maps, weather data, and
satellite images.
Database management system (DBMS) is a collec on of programs that enables users
to create and maintain a database.
constructing, manipulating, and sharing databases among various users and applications.
Roll no – String
Name – String Roll no Name Marks
Marks - Float
The database definition or descriptive information is also stored by the DBMS in the
form of a database catalog or dictionary; it is called meta-data
◦ Constructing the database is the process of storing the data on some storage
medium
eg
Roll no Name Marks
1 Akhil 34
2 Sajan 42
3 Vivek 21
Manipula ng a database includes func ons such as querying the database to
retrieve specific data, upda ng the database.
Sharing a database allows mul ple users and programs to access the database
simultaneously.
DBMS include protec ng the database and maintaining it over a long period of me
Database system contains not only the database itself but also a complete
definition or description of the database structure and constraints.
This definition is stored in the DBMS catalog
information stored in the catalog is called meta-data and it describes the
structure of the primary database.
\
E
2. Insula on between programs and data, and data abstrac on
The structure of database is stored in the DBMS catalog separately from the
access programs.
This property is called program-data independence.
Eg: in Student db
If we wish to add a new a ribute DOB we can do without affec ng the data
1 Akhil 34
2 Sajan 42
3 Vivek 21
A database typically has many users, each of whom may require a different
perspective or view of the database.
A view may be a subset of the database or it may contain virtual data that is
derived from the database files but is not explicitly stored
1 Akhil 34
2 Sajan 42
3 Vivek 21
Student database
Name
Akhil
View 1: Name of the students
Sajan
Vivek
--
Roll no Name Marks
2 Sajan 42
View 2: Details of the students with highest mark
Advantages of DBMS
1.Controlling Redundancy
o In traditional file processing every user maintains the copy of same file
o But in DBMS same copy can be shared among many users, thus redundancy can be
avoided
Indexing technique
Buffered storage
o Most database applications have certain integrity constraints that must hold for the
data
o specifying a data type for each data item is an integrity constraint
o referential integrity constraint : A more complex type of constraint that frequently
occurs involves specifying that a record in one file must be related to records in other
files.
o key or uniqueness constraint :
o This constraint specifies uniqueness on data item values,
Actors on the Scene
Database Administrators
Database Designers
End Users
o Casual end users
o Naive or parametric end users
o Sophisticated end users
o Standalone users
System Analysts and Application Programmers
I . Database Administrators
A person who has such central control over the system is called a database
administrator (DBA).
Role of DBA
Schema definition.
o The DBA creates the original database schema by executing a set of
data definition statements in the DDL
Storage structure and access-method definition.
o The DBA may specify some parameters pertaining to the physical
organization of the data and the indices to be created.
Schema and physical-organization modification
o The DBA carries out changes to the schema and physical organization
to reflect the changing needs of the organization
Granting of authorization for data access.
o By granting different types of authorization, DBA can regulate which
parts of the database various users can access
Routine Maintenance:
o Routine maintenance activities of DBA are
o Periodically backing up the database
o Ensuring that enough free disk space is available for normal operation
o Monitoring jobs running on the database and ensuring that performance
is not degraded by expensive tasks submitted by some users
II Database Designers
Responsible for
identifying the data to be stored in the database
choosing appropriate structures to represent and store this data
communicate with all database users in order to understand their
requirements and to create a design that meets these requirements
III End Users
They are the people, whose jobs are to access the database for querying,
updating, and generating reports
Categories of end users
1. Casual end users occasionally access the database, but they may
need different information each time.
They use a sophisticated database query language to specify their
requests
2. Naive or parametric end users
constantly query and update the database, using standard
types of queries and updates
The tasks that such users perform are
a. Bank tellers check account balances and post withdrawals
and deposits
b. Reservation agents for airlines, hotels, and car rental
companies check availability for a given request and make
reservations
3. Sophisticated end users
They include engineers, scientists, business analysts, and others
They familiarize themselves with the facilities of the DBMS in
order to implement their own applications
4. Standalone users
maintain personal databases by using ready-made program
packages that provide easy-to-use menu-based or graphics-based
interfaces
An example is the user of a tax package that stores a variety of
personal financial data for tax purposes
IV System Analysts and Application Programmers (Software Engineers)
System analysts determine the requirements of end users and develop
specifications that meet these requirements.
Application programmers implement these specifications as programs;
then they test, debug, document, and maintain these system.
Such analysts and programmers—commonly referred to as software
developers or software engineers
Workers behind the Scene
These are people who work to maintain the database system environment, and they are
not interested in the database content
1. DBMS system designers and implementers
2. Tool developers
3. Operators and maintenance personnel
2. Tool developers
Tools are optional packages that are often purchased separately.
They include
Structured Data
o The data is well organized either in the form of tables or some other way
o Searching & accessing information from such data is very easy
o Eg Relational Database (data stored in tables), spreadsheets
Semi - structured data
o Semi-structured data is information that doesn’t reside in a relational
database but have some organizational properties that make it easier to
analyze.
o It is difficult to store and retrieve
o These data can be stored in a database after processing it
o For example, CSV, XML and web data such as JSON
Unstructured data
o Data which is not organized in a predefined manner
o It is not fit for relational database
o It includes text and multimedia content. For example, e-mail messages, word
processing documents, videos, photos, audio files, presentations, web pages
DATA MODELS
Collection of concepts that can be used to describe the structure of a database
Structure of a database we mean the data types, relationships, and constraints
that should hold on the data
Most data models also include a set of basic operations for specifying retrievals
and updates on the database
It provides concepts that are close to the way many users perceive data.
Conceptual data models use concepts such as
◦ Entities
◦ Attributes, and
◦ Relationships
o An entity represents a real-world object or concept, such as an employee or a project
from the miniworld that is described in the database.
o An attribute represents some property of interest that describes an entity, such as
the employee’s name or salary.
o A relationship among two or more entities represents an association among the
entities, for example, a works-on relationship between an employee and a project
A. Hierarchical Model
C. Relational Model
Data is organized in two-dimensional tables called relations.
The tables or relation are related to each other.
Each row represents a record, also referred to as an entity.
Each column represents a field, also referred to as an attribute.
A relational DBMS uses multiple tables to organize the data.
Relationships are used to link the various tables together.
Relationships are created using a field that uniquely identifies each record
3. Low-level or physical data models
It provides concepts that describe the details of how data is stored in the
computer
Data models are generally meant for computer specialists, not for typical end
users
It describe how data is stored as files in the computer by representing
information such as
record formats
access paths
An access path is a structure that makes the search for particular database
records efficient
THREE-SCHEMA ARCHITECTURE
Schema, Instances and Database State
INTERNAL LEVEL
CONCEPTUAL LEVEL
It uses representational/Implementational data model
The conceptual level has a conceptual schema, which describes the
structure of the whole database for users
hides the details of physical storage structures and concentrates on describing
entities, data types, relationships, user operations, and constraints
describes what data is stored in the database and the relationships
among the data.
The conceptual level represents
All entities, their attributes
and their relationships
The constraints on the data
Semantic information about
the data
Security and integrity
information
DATA INDEPENDENCE
Data independence is the capacity to change the schema at one level of a
database system without having to change the schema at the next higher
level.
There are two types of data independence.
i. Logical data independence
ii. Physical data independence
Eg: We may change the conceptual schema to expand the database (by adding a
record type or data item), or to reduce the database (by removing a record type
or data item).
After the conceptual schema undergoes a logical reorganization, application
programs that reference the external schema constructs must work as before
Database Architectures
DBMS architecture are of different types
Centralized DBMSs Architecture
Basic Client/Server Architectures
Two-Tier Client/Server Architectures
Three-Tier and n-Tier Architectures
All the DBMS functionality, application program execution, and user interface
processing were carried out on one machine
A centralized database is stored at a single location such as a mainframe
computer.
It is maintained and modified from that location only and usually accessed
using an internet connection such as a LAN or WAN.
The centralized database is used by organizations such as colleges, companies,
banks etc.
2. Basic Client/Server Architectures
DBMS can be classified based on the types of access path options for storing
files.
Access paths are the alternative ways for retrieving specific record from a
relation/table
One well-known family of DBMSs is based on inverted file structures.
6. Based on purpose
DBMS can be general purpose or special purpose.
When performance is a primary consideration, a special-purpose DBMS can
be designed and built for a specific application
such a system cannot be used for other applications without major changes.
Many airline reservations and telephone directory systems are special-
purpose DBMSs. These fall into the category of online transaction processing
(OLTP) systems
Database Languages
It is the language that controls access to the data and to the database.
DCL statements are grouped with the DML statements.
Through DCL we can
o Commit: Save work done
o Rollback: restore database to original since the last commit
ENTITY-RELATIONSHIP MODEL
Entity
Entity is a thing in the real world with an independent existence.
for example, a particular person, car, house or employee
For example, if we say that a customer buys goods, it means customers and
goods are entities.
In E-R diagrams, entities are represented using rectangles
CUSTOMER GOODS
Attributes
Each entity has attributes—the particular properties that describe it.
For example, an EMPLOYEE entity may be described by the employee’s name,
age, address, salary, and job.
In E-R diagrams attributes are drawn in elliptical shapes along with the entity
rectangles
Derived attributes are represented by dotted attributes
Complex Attributes
It is a combination of composite and multi-valued attribute.
Group components of a composite attribute between parentheses () and
separating the components with commas, and by displaying multivalued attributes
between braces { }.
Eg :
Address_phone({phone_no},{Address(Flat no,city,state)})
An entity type defines a collection of entities that have the same attributes or
properties.
Each entity type in the database is described by its name and attributes.
Entity Set is the collection of same type of entities, i.e their attributes are
same is called entity set
Key Attributes of an Entity
An entity type usually has one or more attributes whose values are
distinct for each individual entity in the entity set.
Such an attribute is called a key attribute, and its values can be used to identify
each entity uniquely
In ER diagrammatic notation, each key attribute has its name underlined inside the
oval
Value Sets (Domains) of Attributes
Each simple attribute of an entity type is associated with a value set (or domain of
values), which specifies the set of values that may be assigned to that attribute for each
individual entity.
For example, if the range of ages allowed for employees is between 16 and 70, we can
specify the value set of the Age attribute of EMPLOYEE to be the set of integer
numbers between 16 and 70.
1. The company is organized into departments. Each department has a unique name,
a unique number, and a particular employee who manages the department. We
keep track of the start date when that employee began managing the department.
A department may have several locations.
2. A department controls a number of projects, each of which has a unique name, a unique
number, and a single location.
We store each employee’s name, Social Security number, address, salary, sex
(gender), and birth date. An employee is assigned to one department, but may work
on several projects, which are not necessarily controlled by the same department. We
keep track of the current number of hours per week that an employee works on each
project. We also keep track of the direct supervisor of each employee (who is
another employee).
We want to keep track of the dependents of each employee for insurance purposes. We
keep each dependent’s first name, sex, birth date, and relationship to the employee
Relationship in DBMS
Whenever an attribute of one entity type refers to another entity type, some
relationship exists.
the attribute Department of EMPLOYEE refers to the department for which
the employee works
RELATIONSHIP
Relationship is the association among several entities.
Eg2
Relationship Type
The relationship which is associating with different entities
Relationship Set
A relationship set is a set of relationships of the same type.
Unary relationship
Association is maintained within a single entity.
Binary relationship
Association is maintained within two entities.
Ternary Relationship
Association is maintained within three entities
Cardinality ratio
The cardinality ratio for a binary relationship specifies the maximum number
of relationship instances to which an entity can take part in it.
The no of entities to which another entity can be associated via a relationship set
The possible cardinality ratios for a binary relationship types are
o One to one (1:1)
o One to many (1:N)
o Many to one (N:1)
o Many to many (M:N)
1. One to one:
An entity A is associated with atmost one entity in B and an entity in B is
associated with atmost one entity in A.
2. One to Many:
An entity A is associated with any no of entities in B and an entity in B can be
associated with atmost one entity in A.
3. Many to one:
Total Participation:
o if every entity in the entity type participates in at least one relationship in the
relationship type
o Represented by double lines in ER Diagram
Partial Participation :
o Some entities may not participate in any relationship in the relationship type
o Represented by single line in ER Diagram
Eg1
Entity Project should have atlease one department, So Project has Total
Participation
There can be no Department which is assigned any project , So Department has
Partial Participation
Eg2