Database Management System
Database Management System
UNIT-I
UNIT-II
CHAPTER I
DATABASE MANAGEMENT SYSTEM
UNIT I
Updating
data
Extractio
n of data
Database
Management
System
Modification of
data
Storing of
data
UNIT I
Process of Database
UNIT I
Database Organisation
Database Organisation defines how and where the data are organised in
physical storage.
Desig
n
Developme
nt
UNIT I
Major Components of Database
Basic
Components
Description
Commands used
CREATE DATABASE (To create a
database): CREATE DATABASE
<database-name> ;
DROP DATABASE (To removes the
database) : DROP DATABASE
<database-name> ;
CREATE TABLE (To create tables) :
CREATE TABLE <table-name> ( ...);
DROP TABLE (removes the table) :
DROP TABLE <table-name> ;
ALTER TABLE (To alter tables after
the creation of table) :
ALTER TABLE <table-name> ADD
<field-name> <data-type>
ALTER TABLE <table-name> DROP
<field-name>
ALTER TABLE <table-name>
MODIFY <field-name> <new-fielddeclaration>
DDL (Data
Definition
Language )
It is used to create
and destroy
databases and
database objects.
UNIT I
Major Components of Database
Basic
Descriptio Commands used
Component n
s
DML (Data
Modified
Language )
Modification
of data like
insert, select
and update
data.
UNIT I
Disadvantages
CHAPTER II
DATA MODELING
DATA MODELING
UNIT I
Introduction of Data Modeling
Types
of Data
Model
Implementati
on Data
Model
High level
or
conceptua
l
Ex: E-R
Model
Hierarc
hical
Data
Model
Network
Data
Model
Relation
al Data
Model
Physical
Data
Model
Object
Based
Data
Model
Semi
structure
d Data
Model
Explain how
data stored
on disk and
what access
methods are
available
UNIT I
DATA MODELING
Implementation Data Model hide some data storage details from the user.
Some of the data models:
Hierarchial data model:
i.
It is a tree like structure having both child and parent node.
ii. Each child node can have only one parent node.
iii. It comprises of a set of records connected to one another through
links.
Network data model:
i.
Data is represented by a collections of records, relationship among
data are
represented by links.
ii. All nodes are link to each other without any hierarchy.
iii. It is organised in the form of graphs.
iv. It is quite complicated to handle.
UNIT I
DATA MODELING
Physical Data Model describes the data in terms of collection of files, indices
and other storage structure.
It describes how the data is stored in disk and what access methods are
available
CHAPTER III
INTRODUCTION TO RELATIONAL
DATABASE MANAGEMENT
SYSTEMS
UNIT II
UNIT II
Key
The Candidate Key cannot contain NULL value and should always
contain a unique value.
Primary key is the candidate key in the relation whose values are used
to identify tuples.
UNIT II
Constraints
Constraints are logic rules that are used to ensure data consistency.
Major integrity constraints:
Domain constraints: Value of each attribute must be atomic from the
domain.
The major components of domain constrains:
a. Domain name
b. Meaning
c. Data type
d. Size or length
Entity integrity constraints:
a. It states that no part of a primary key field can contain NULL value.
b. The primary key value is used to identify individual tuples in a relation.
c. Entity integrity constraints are specified on the individual relations.
Referential integrity constraints:
a. Concept of relationships between tables, based on the definition of a
primary key and a foreign key.
b. Referential integrity is a mechanism which prevents accidental database
corruptions when doing inserts, updates, and deletes.
c. Referential constraint provide security to the database.
Operational constraints: These constraints are used in an organisation for
business rules and policies.
UNIT II
Codds 12 Rules
Rule 1
Rule 2
Rule 3
Rule 4
Rule 5
Rule 6
Rule7
Rule 8
UNIT II
Codds 12 Rules
Rule 8
Rule 9
Rule 10
Integrity independence
Rule 11
Distribution independence
Rule 12
CHAPTER IV
RELATIONAL DATABASE
MANAGEMENT SYSTEMS AND
NORMALISATION
UNIT II
Process of Normalization
UNIT II
UNIT II
Each table has a primary key: minimal set of attributes which can
uniquely identify a record
The values in each column of a table are atomic (No multi-value
attributes allowed).
There are no repeating groups: two columns do not store similar
information in the same table.
UNIT II
Registration Table
Student Table
UNIT II
Student Table
Registration
Table
Advisor Table
UNIT II
CHAPTER V
DATABASE DESIGN AND ENTITYRELATIONSHIP MODELLING
UNIT II
Design Process
Data to be
stored
Superimpose a
logical structure
upon the data
Determine
relationship
between
different Data
Determining the
group of
information
Determine the
relationship
between the
groups
UNIT II
Diagram
Symbol
Meaning
Entity
Weak Entity
Relationship
UNIT II
People
Lives in
Names
UNIT II
Attributes
Every entity is described by a set of (attribute, data value) pairs.
Types of attributes:
Simple and Composite Attributes: Attribute which is composed of a single
component with an independent existence is called the simple attribute.
Single valued and multi-valued attribute: The attributes that hold a single
value for a single entity are single valued.Ex: an enrolment number attribute
for the particular student may refer to only one enrolment number
Null Attributes : A null value is used when an entity does not have a value
for an attribute.
Derived attributes: The value for this type of attribute can be derived from
the values of other related attributes or entities.
UNIT II
Entity-Relationship Diagram
Definition:
An entity-relationship (ER) diagram is a specialized graphic that illustrates the
interrelationships between entities in database.
Sample E-R
Diagram
UNIT II
Unary Relationships
Binary Relationships
Ternary relationship
Quaternary relationship
Cardinalities
Cardinality expresses the number of entities to which another entity can be
associated via a relationship set.
A cardinality is expressed with the help an crowsfoot symbol ( ) in ERD.
The cardinality relationship must be one of the following points:
One-to-one
One-to-many
Many-to-one
Many-to-many
CHAPTER VI
SQL: QUERIES AND SUBQUERIES
UNIT III
Smallint
Double Precision
DATE
Time
Timestamp
UNIT III
Clauses in SQL
SQL Data Query Language (DQL):
DQL has only one data query statement whose syntax is SELECT.
Syntax
SELECT [ DISTINCT | ALL ]
column_expression1, column_expression2, ....
[ FROM from_clause ]
[ WHERE where_expression ]
[ GROUP BY expression1, expression2, .... ]
[ HAVING having_expression ]
[ ORDER BY order_column_expr1, order_column_expr2, .... ]
Example
SELECT name FROM s WHERE city=Rome
Where "s" is the name of the table
List of suppliers
Supplier
Pierre
John
Mario
Location
Paris
London
Rome
UNIT III
ORDER BY Clause
It must be the last clause in the SELECT statement.
The ORDER BY clause defines the ordering of rows based on columns from the
SELECT clause.
The ORDER BY clause has the following general format:
ORDER BY column-1 [ASC|DESC] [column-2 [ASC|DESC]]...
ORDER BY sorts rows using the ordering columns in left-to-right, major-to-minor
order.
UNIT III
Types of Functions
Basics types of functions:
Aggregate Functions
Scalar Functions
Aggregate Functions
Function
AVG (column)
Description
COUNT(*)
MAX(column)
MIN(column)
SUM(column)
COUNTS (Column)
UNIT III
Scalar Functions
Scalar functions operate against a single value, and return a single value based on
the input value. The built in functions:
SUBSTRING (exp-1 FROM exp-2 [FOR exp-3])
Extracts a substring from a string - exp-1, beginning at the integer value exp2, for the length of the integer value - exp-3
TRIM([LEADING|TRAILING|BOTH] [FROM] exp-1)
TRIM([LEADING|TRAILING|BOTH] exp-2 FROM
exp-1)
Trims leading, trailing or both characters from a string Data
exp-1. Definition Language (DDL)
1. The DDL provides commands for defining relation schemas, deleting relation
schemas and modifying relation schemas
2. The syntax of the commands are CREATE, ALTER and DROP
Syntax for CREATE Table
CREATE TABLE "table_name"
("column 1" "data_type_for_column_1",
"column 2" "data_type_for_column_2",
... )
CHAPTER VII
DATABASE SECURITY AND
INTEGRITY
UNIT III
UNIT III
Data Tampering
UNIT III
UNIT III
Authentication
Integrity
Integrity means that data should be protected from deletion and corruption.
Referential Integrity is the ability to maintain valid relationships between
values in the database.
Availability
There are number of aspects in system availability:
Resistance: User profiles must be in place to define and limit the
resources any given user may consume
Scalability: System performance must remain adequate regardless
of the number of users or processes
Flexibility: Administrators must have adequate means of
managing the user population
Ease-of-use: Availability of valid user to get the work done
CHAPTER VIII
DATABASE SECURITY AND
INTEGRITY
UNIT III
Introduction
UNIT III
Components of DBMS
Major software modules or components of DBMS are as follows:
Query processor
DML processor
DDL processor
Query Processor
The query processor transforms user queries into series of low level
instructions.
It is used to interpret the online user query and convert it into an efficient
query.
Query processor
Runtime
Database
use Manager
the data dictionary to find the structure of relevant
portion.
It handles database during runtime.
The run time data manager then places a call to the physical database to
perform the request.
UNIT III
DML Processor
DML processor converts the DML statements into standard function calls in
the host language.
The DML compiler converts the DML statements written in host
programming language into object code for database access.
DDL Processor
The DDL processor converts the DDL statements into a set of tables
containing metadata.
These tables are then stored in the system catalog while control
information is stored in data file headers.
The DDL compiler processes schema definitions, specified in the ddl and
stores description of the schema.
The system catalog includes information such as the names of data files,
data items, storage details.
UNIT III
Functions of DBMS
Types of
DBMS
Types of DBMS
Centralised DBMS
Distributed DBMS
Client/Server DBMS
UNIT III
UNIT III