Unit I Introtodbms
Unit I Introtodbms
DATABASE MANAGEMENT
SYSTEM
2015 Course
Prof.K.B.Sadafale
Asst.Professor
SCOE,Pune
Teaching Scheme :- Lectures: 4 Hrs/ Week
Examination Scheme:-
In-Semester Assessment
Phase I – 30 Marks
End-Semester Assessment
Phase II – 70 Marks
Course Objectives
1. Understand the fundamental concepts of database management.
These concepts include
aspects of database design, database languages, and database-system
implementation.
2. To provide a strong formal foundation in database concepts,
technology and practice.
3. To give systematic database design approaches covering
conceptual design, logical design and an overview of physical
design.
4. Be familiar with the basic issues of transaction processing and
concurrency control.
5. To learn and understand various Database Architectures and
Applications.
6. Understand how analytics and big data affect various functions
now and in the future.
Course Outcomes
1. Define basic functions of DBMS & RDBMS.
2. Analyze database models & Entity Relationship
Models.
3. Design and implement a database schema for a given
problem-domain
4. Populate and query a database using SQL DML/DDL
commands.
5. Programming PL/SQL including stored procedures,
stored functions, cursors and packages
6. Appreciate the impact of analytics and big data on the
information industry and the external ecosystem for
analytical and data services
Syllabus
UNIT I. INTRODUCTION TO DBMS
.
UNIT I. Introduction
Introduction:
Database Concepts, Database System Architecture, Data Modeling: Data Models, Basic Concepts,
entity, attributes, relationships, constraints, keys.
E-R and EER diagrams:
Components of E-R Model, conventions, converting E-R diagram into tables, EER Model
components, converting EER diagram into tables, legacy system model.
Relational Model:
Basic concepts, Attributes and Domains, Codd's Rules.
Relational Integrity:
Domain, Entity, Referential Integrities, Enterprise Constraints, Schema Diagram.
Relational Algebra:
Basic Operations, Selection, projection, joining, outer
join, union, difference, intersection, Cartesian product,
division operations (examples of queries in relational
algebraic using symbols).
Text Books
a telephone book
T.V. Guide
airline reservation system
motor vehicle registration records
papers in your filing cabinet
files on your computer hard drive
Why do we need a database?
Keep records of our:
Clients
Staff
Volunteers
To keep a record of activities;
Keep sales records;
Develop reports;
Perform research
Longitudinal tracking
What is the ultimate purpose of
a database management
system?
Is to transform
Almost everyone:
Business
Doctors
Teachers
Students
Purpose of Database System
1.let's look at a typical file-processing system" supported by a
conventional operating system.
1. Physical Level:
Highest level.
Conceptual Level
Physical Level
The Elements of a Database
schema construct
Known data:
name of record types, data items
Example: University Database
Conceptual schema:
Physical schema:
Course_info(cid:string, enrollment:integer)
The DDL , just like any programming languages , gets an input some
instructions and generates some output.
Referential Integrity –
There are cases where we wish to ensure that a value that
appears in relation for a given set of attributes also appears for
a certain set of another relation.
Database modifications can cause violations of referential
integrity.
When a referential integrity constraints is violated , the normal
procedure is to reject the action that caused the violation.
Assertions –
An assertion is any condition that the database must always
satisfy.
Domain constraints and referential integrity constraints are special
forms of assertion.
There are many constraints that we cannot express by using only
these special forms.
E.g. “Every loan has at least one customer who maintains an
account with minimum balance of $10,000” must be expressed as
an assertion.
Authorization –
We may want to differentiate among the users as far as the type of
access they permitted on various data values in database.
These differentiation are expressed in terms of authorization.
E.g. Read authorization, insert authorization , delete
authorization , update authorization
Data Manipulation Language (DML)
A data manipulation language (DML) is a language that enables
users to access or manipulate data.
The goal is to provide efficient human interaction with the
system.
Data Manipulation is:
Query Language:-
Language used to interact with databases are called query
languages, of which SQL is well known standard.
The portion of a DML that involves information retrieval is
called a query language.
It is a common practice to use the terms query language and
data manipulation language synonymously.
Data Models
Data model is a collection of concepts that can be used to describe the
structure of a database.
Data models are a collection of conceptual tools for describing data, data
relationships, data semantics(relation between stored data and real world)
and data constraints
Business Model is a plan implemented by a company to generate revenue
and make a profit from operations
The model includes the components and functions of the business , as well
as the revenues it generates and the expenses it incurs.
There are three different Models
Student entity set has four entities john, smith , sana , Lee
Attributes
An entity is represented by a set of attributes, that is
descriptive properties possessed by all members of an
entity set.
Example:
customer = (customer-id, customer-name,
customer-street, customer-city)
Attributes of
Supplier
Attributes
Attribute types:-
Simple and composite attributes.
Single-valued and multi-valued attributes
E.g. multivalued attribute: phone-numbers
Derived attributes
Can be computed from other attributes
E.g. age, given date of birth
Composite Attributes
Relationship:-
A relationship is an association among several entities.
e.g. A cust_acct relationship associates a customer with each
account he or she has.
The set of all relationships of the same type is called the
relationship set.
Example:
Hayes depositor A-102
customer entity relationship set account entity
Relationships between more than two entity sets are rare. Most
relationships are binary.
Ternary relationship set
Branch
city
Branch
Name Assets
Branch
Social
security Street
Account
Balance
No
Cust city
Name
Customer Account
Job
Mapping Cardinalities
Express the number of entities to which another entity can be
associated via a relationship set.
Most useful in describing binary relationship sets.
For a binary relationship set the mapping cardinality must be
one of the following types:
One to one
One to many
Many to one
Many to many
Mapping Cardinalities
Note: Some elements in A and B may not be mapped to any elements in the
other set
Mapping Cardinalities
5. A person can own more than one car. A car can only have one owner. So
Owner to Car will be a one to many or 1:M relationship.
6. A person can buy one or many movie tickets. A ticket will belong to only one
person.
The many to many relationship m:m
Examples:
1. Student - professor. A student will have one or more
professors. The same professor will have lots of students.
Relational DBMS
Implementation
E-R Diagrams
relationship borrower
A loan is associated with at most one customer via
borrower
One-To-Many Relationship
In the one-to-many relationship a loan is associated with at
most one customer via borrower, a customer is associated
with several (including 0) loans via borrower
Many-To-Many Relationship
The discriminator (or partial key) of a weak entity set is the set
of attributes that distinguishes among all the entities of a weak
entity set.
Example: EMPLOYEE/SECRETARY,
EMPLOYEE/TECHNICIAN
Another example of super class and sub class:-
Super class
vehicle
truck scooter
Bus car
Sub class
Specialization
Is the process of defining a set of subclasses of a super class.
The set of subclasses is based upon some distinguishing
characteristics of the entities in the super class.
Example: {SECRETARY, ENGINEER, TECHNICIAN} is
a specialization of EMPLOYEE based upon job type.
May have several specializations of the same super class.
Example: Another specialization of EMPLOYEE based in
method of pay is {SALARIED_EMPLOYEE,
HOURLY_EMPLOYEE}.
Super class/subclass relationships and specialization can be
diagrammatically represented in EER diagrams.
sid
student
name
is A
Undergrad graduate
sid
student
name
is A
Generalization Specialization
Undergrad graduate
Generalization Specialization
Generalization Specialization
Aggregation
The E-R model cannot express relationships among relationships.
When would we need such a thing?
Consider a DB with information about employees who work on a
particular project and use a number of machines doing that work. We get
the E-R diagram shown in Figure
Hours Member
Name Id
Employee Project
Work
Users
Id
Relationship sets work and uses could be combined into a
single set. However, they shouldn't be, as this would obscure
the logical structure of this scheme
For our example, we treat the relationship set work and the
entity sets employee and project as a higher-level entity set
called work.
Name Id Hours Member
Work Project
Employee Work
Users
Machinery
Id
tuples
(or rows)
Codd's Rules
Codd's twelve rules are a set of
thirteen rules (numbered zero to
twelve) proposed by Edgar F. Codd, a
pioneer of the relational model.
For databases, designed to define what
is required from a database
management system in order for it to
be considered relational, i.e., a
relational database management
system (RDBMS).
0.Foundation Rule
A relational database management system must manage its stored
data using only its relational capabilities.
1. Information Rule
All information in the database should be represented in one and
only one way - as values in a table.
12.Nonsubversion Rule
If a relational system has or supports a low-level (single-record-at-
a-time) language, that low-level language cannot be used to subvert
or bypass the integrity rules or constraints expressed in the higher-
level (multiple-records-at-a-time) relational language
The Network Model
Relational Model
Network Model
The Hierarchical Model
Similar to the network model
A hierarchical data model is a data model in which the data
is organized into a tree-like structure.
Organization of the records is as a collection of trees, rather
than arbitrary graphs
The structure allows representing information using
parent/child relationships: each parent can have many children
but each child only has one parent (also known as a 1:many
ratio ).
In a database, an entity type is the equivalent of a table
each individual record is represented as a row and
an attribute as a column.
A sample hierarchical database
Data Independence
The ability to modify a scheme definition in one level without
affecting a scheme definition in a higher level is called data
independence.
Security enforcement:-
Ensuring that users only have access to information they are
permitted to see.
Concurrency control:-
Preserving data consistency when there are concurrent users.
Database Administrator
The database administrator is a person having central control
over data and programs accessing that data.
Scheme definition:-
The creation of the original database scheme.
This involves writing a set of definitions in a DDL , compiled
by the DDL compiler into a set of tables stored in the data
dictionary.
Sophisticated users:-
Naive users:-
Components include:-
File manager :-
manages allocation of disk space and data structures used to
represent information on disk.
Database manager :-
The interface between low-level data and application
programs and queries.
Query processor :-
Translates statements in a query language into low-level
instructions the database manager understands.
DML precompiler :-
Converts DML statements embedded in an application
program to normal procedure calls in a host language.
The precompiler interacts with the query processor.
DDL compiler :-
Converts DDL statements to a set of tables containing
metadata stored in a data dictionary.
In addition, several data structures are required for physical
system implementation :-
Data files :-
Store the database itself.
Data dictionary :-
Stores information about the structure of the database. It is
used heavily.
Great emphasis should be placed on developing a good design
and efficient implementation of the dictionary.
Indices :-
Provide fast access to data items holding particular values.
Overall System Structure
Schema Diagram
A database schema ,along with primary key and foreign key
dependencies, can be depicted pictorially by schema diagram.
Primary key
Foreign key
Relation
Attribute
Schema Diagram for University Database
Integrity
Integrity constraints are used to ensure accuracy and
consistency of data in a relational database.
Data integrity is handled in a relational database through the
concept of referential integrity.
During the data analysis phase, business rules will identify any
column constraints.
For example, a salary cannot be negative.
an employee number must be in the range 1000 - 2000, etc.
3) Compare DBMS and file processing system with following points. [4 marks]
i) Redundancy
Ii) Access control
4) What is difference between specialization and generalization ? Why do we not display this
difference in schema diagram [6 marks]
6) What are the enhancement that distinguish the EER model from the ER model ? Explain with
example [6 marks]