DBMS Unit 1
DBMS Unit 1
UNIT -1
Introduction to Database and
Conceptual Design using ERD
Database
•
collection of data
specific
°
purpose
•
relational models ( RDBMS) , object-oriented COODBMS) ,
NOSQL etc .
•
allows user to
-
define datatypes q constraints
-
construct ( store) data
-
manipulate data
through queries
businesses (
banking insurance transport manufacturing)
•
, , ,
, , ,
e-commerce
,
'
•
•
science and research
•
education
personal apps
•
users
/ programmers
Database v
DBMS
software : query processing
software
and
programs
✓
n n
L ✓
database database
definition
•
students , courses , departments ,
instructors sections etc .
( different
,
entities)
-
© vibha’s notes 2021
Characteristics of DB Approach
Self
describing nature of DB
system
•
-
-
metadata stored for each DB data definition
-
stored in a
catalog on disk
y language
datatypes constraints (specified DDL statements)
by
-
-
NOSQL DBS do not have structure and not have metadata
may
Data abstraction
users
provided only with conceptual view of DB ; internal
-
no
structures
access
programs
ACID :
atomicity , concurrency isolation , durability
,
: or
:
,
OLTP
-
Database Users
•
use and control DB content
•
end users
-
casual users ( occasional use)
or
sophisticated end
-
users
-
DB admins C authorise DB access)
( convert
DB designers requirements to ☐ DL statements)
-
and maintenance
operators personnel
•
canned Application
transactions Query
programs
Cpre compiled ) n
,
CSQL)
r
DBMS
retrieval
Efficient query
processing
•
}
•
Hierarchical Data Model HDBMS 1960 's and 70's
•
Network Data Model NDBMS
•
Relational Data Model RDBMS } 1970 's and 80 's
•
data models
•
Describes structure of DB
datatypes
-
Operations
•
Basic operations leg insert delete
: , update )
,
•
User -
defined operations ( like user -
defined functions)
data
1.
Conceptual or
High-level model
°
ER model
'
°
2-
Physical or low -
level Data Model
data structures for
storage
°
3.
Implementation or
Representational Data model
•
commercial DBMS ( relational)
Self
4. -
DATABASE SCHEMA
•
Also called intension
•
Valid state : database state follows constraints
°
Initial state : state when loaded into the
system
•
Also called extension
•
To ensure
-
program
-
data independence
multiple views
-
catalogs
-
•
end user → mini statement →
conceptual schema
end users
v L
ER conceptual schema
conceptual
^
level
Internal
physical internal schema
level
storage
schemas
d) Logical independence
data
without to
change conceptual schema having change
-
external schema
schema
conceptual
DBMS
languages
d) Data Definition CDDL)
Language
•
DBA and DB
designers
°
Define schemas
°
DDL compiler
,
•
Low level-
DBMS Interface
Stand alone
1-
query language interfaces
-
interfaces
2.
Programmer to embed Dmt in
programming
languages
3.
User-friendly interfaces
-
4 . Mobile interfaces
mobile transactions © vibha’s notes 2021
-
eg :
DATABASE SYSTEM UTILITIES
1.
Loading utility
•
Load data from files into a DB
°
2. Backup Utility
Backing up the DB
periodically
•
Incremental or total
•
3.
Storage Reorganisation
Reorganising database file structures
•
•
Create new access paths
Performance
4.
monitoring
•
monitors DB use
•
sends stats to DBA
Other TOOLS
Data
dictionary / repository
•
-
schema descriptions , design decisions etc
-
J Builder ( Borland)
-
1. centralised Architecture
Client
etc )
.
provides UI capabilities
processing
DBMS server
☐
Intermediate layer between client and server
, ,
based
2. Other classifications
vs -
• centralised vs distributed
distributed
Homogeneous vs
heterogeneous DBMS
•
T T
same DBMS different DBMS
at all sites at all sites
Eg graph
: database CNeo4j) star wars
84
https://towardsdatascience.com/presenting-multiple-node-label-support-and-graph-mutability-features-of-the-neo4j-graph-data-a0b0ea7448
°
Each department has a name , number and an employee who
manager
Department may have several locations
•
•
Each department controls a number of PROJECTS
•
Each project has a
unique name number and location
,
•
DB stores each EMPLOYEE 's SSN address salary sex , birthdate
, , ,
for
Each employee works department but work
•
one
may on
several projects
•
DB keeps track of no .
of hours per week that an employee
works on a
project
© vibha’s notes 2021
keep track of direct supervisor of each employee
•
°
Each employee has a number of DEPENDENTS
DB records each dependent 's name , sex birthplace relationship
•
,
,
with employee
Entity
•
Basic concept for ER model (relation)
world
•
of attributes)
Physical or conceptual (
degree no
•
: .
•
Entities have attributes
•
Rectangle
•
Attribute
•
Types of Attributes
is simple / composite Attributes
atomic valued attribute
Simple : single
°
eg Aadhaar number
-
:
DOB
eg
:
-
Multi valued:
may have multiple values ; two oval lines
•
-
multi valued
attribute
✗
p
primary
derived
key ✗
°
I :/ 1 : N N :| N : 1 M : N
, , , ,
•
Can also use 1min ,
Max)
representation
-
1
employee manages 1 dept
1 dept
managed by 1
employee
-
pick a side
-
can
Tl
cii ) 1 : N
-
N students in 1 elective
-
1 elective can have N students
-
stored at N side
1 student has elective
only one
-
1 N
ELECTIVE ENROLS STUDENT
iii ) N :|
-
N students in 1 section
-
1 section has N students
-
stored at N side
-
1 student is in only 1 class
N 1
STUDENT IN SECTION
N courses have M
registered students in total
-
-
create separate table
TI
Relationships
, use
•
Recursive : one employee manages N
empolyees self-referential
relationship C
mandatory to
specify role names)
supervisor supervise
Empolyee
el ez
supervises
© vibha’s notes 2021
Key Attribute
manufacturer
vehicle regno
Disadvantages of E-R
Diagram
•
Normalisation Reduce : the NULL entries
;
cannot be achieved
with E-R
diagram
•
cannot represent datatypes in ER
diagram
weak
Entity
partial key : Dotted line ; not
always unique
•
have a
;
associated with at least one
strong entity
called
identifying relationship
•
identifying
relationship
weak
employee depends dependent
partial entity
complete
participation
participation
• The university is organized into colleges (COLLEGE), and each college has a unique
name (CName), a main office (COffice) and phone (CPhone), and a particular faculty
member who is dean of the college. Each college adminis- ters a number of
academic departments (DEPT). Each department has a unique name (DName), a
unique code number (DCode), a main office (DOffice) and phone (DPhone), and a
particular faculty member who chairs the department. We keep track of the start date
(CStartDate) when that fac- ulty member began chairing the department.
• The database will keep student data (STUDENT) and stores each student’s name
(SName, composed of first name (FName), middle name (MName), last name
(LName)), student id (Sid, unique for every student), address (Addr), phone (Phone),
major code (Major), and date of birth (DoB). A stu- dent is assigned to one primary
academic department. It is required to keep track of the student’s grades in each
section the student has completed.
• Courses are offered as sections (SECTION). Each section is related to a single course
and a single instructor and has a unique section identifier (SecId). A section also has a
section number (SecNo: this is coded as 1, 2, 3, . . . for mul- tiple sections offered
during the same semester/year), semester (Sem), year (Year), classroom (CRoom: this
is coded as a combination of building code (Bldg) and room number (RoomNo) within
the building), and days/times (DaysTime: for example, ‘MWF 9am-9.50am’ or ‘TR
3.30pm-5.20pm’— restricted to only allowed days/time values). (Note: The database
will keep track of all the sections offered for the past several years, in addition to the
current offerings. The SecId is unique for all sections, not just the sections for a
particular semester.) The database keeps track of the students in each section, and
the grade is recorded when available (this is a many-to-many relationship between
students and sections). A section must have at least five students.
•
min Ee Max no .
of relationship instances
Ary Relationships
identifying relationship
binary relationships
ternary relationship
Rt
•
Entities can be related to themselves
course #
Mature
study
students partner
Novice
name
Rl
T1