DBMS Notes Unit 1
DBMS Notes Unit 1
Disadvantages of DBMS:
DBMS implementation cost is high compared to the file system
Complexity: Database systems are complex to understand
Performance: Database systems are generic, making them suitable for various applications.
However this feature affect their performance for some applications .
They are large in size.
A Database is a collection of related data organized in a way that data can be easily accessed,
managed and updated.
A Database-management system (DBMS) is a collection of interrelated data and a set of programs
to access those data. The primary goal of a DBMS is to provide a way to store and retrieve database
information that is both convenient and efficient. A DBMS is a software that allows creation, definition
and manipulation of database, allowing users to store, process and analyze data easily.DBMS also
provides protection and security to the databases. It also maintains data consistency in case of multiple
users. e.g: Mysql, Oracle, SQL Server
Users of Database:
A primary goal of a database system is to retrieve information from and store new information
into the database.People who work with a database can be categorized as database users.
o DBA(Database Administrator)
Person who has central control of both the data and the programs that access those data. DBA
takes care of the security of the DBMS, it's availability, managing the license keys, managing user
accounts and access etc.
Functions:
Schema definition: The DBA creates the original database schema by executing a set of data
definition statements in the DDL.
Storage structure and access method definition.
Schema and physical organization modification: Changing needs of organization or alter
physical organization to improve performance.
Granting of authorization for data access
Routine maintenance: Backing up database, monitoring job running
o Application Programmer:
Application programmers are computer professionals who interact with the DBMS through
application programs.Application programs are programs written in any host language (e.g.
VB,C,C++)and interact with the DBMS through DML calls.
o Sophisticated users:
They interact with the system without writing programs.They form their request in a
database query language.
o Specialised users:
Specialised users are sophisticated users who write specialized database applications.
o Naive users:
Naive users are unsophisticated users who interact with the system by invoking one of the
application programs that have been written previously.He is not concerned with or even aware
of the details of the DBMS.Naive users deal only with the highest level of abstraction.
Data Model
A Database model defines the logical design and structure of a database and defines how data
will be stored, accessed and updated in a database management system.The three groups of data
models are
1.Object based logical model
2.Record based logical model
3.Physical model
1.Object based logical model:
These are used in describing data at the logical and view level.They provide fairly flexible
structuring capabilities and allows the specification of data constraints. Different types of object based
logical models are
o The Entity Relationship model
o Object oriented model
E-R Model:
The E-R model is based on a perception of a real world that consists of a collection of basic
objects called entities and relationship among these objects.An entity is a thing or object in the real
world that is distinguishable from other objects. An Entity can be any object, place, person or class
For example; Each person is an entity .Entities are described in a database by a set of attributes.
Account AccNo, Balance
(Entity) (Attributes)
[Let's take an example, If we have to design a School Database, then Student will be an entity with attributes name, age,
address etc. As Address is generally complex, it can be another entity with attributes street name, pincode, city etc, and
there will be a relationship between them.]
A relationship is an association among several entities.
The set of all entities of the same type is termed as Entity set.
The set of all relationships of the same type is termed as Relationship set.
The overall logical structure of a database can be expressed graphically by an E-R
Diagram
Lines which link attributes to entity set and entity set to relationship
Cust_name Cust_cit Acc_no
y
Depo
Customer siter Account
Acc balance
A sample E-R Diagram
Weak Entity set:An entity set that does not have sufficient attributes to form a primary key .It is an
entity that depends on another entity. Double rectangle is used to represent a weak entity.
Strong Entity set:An entity set that has a primary key is termed as a strong entity set .
Mapping Cardinalities:
The E-R model represent certain constraints to which the contents of a database must
conform.One important constraint is mapping cardinalities,which express the number of entities to
which another entity can be associated via a relationship set.
For a binary relationship set between entity sets A and B, the mapping cardinality must be one
of the following
One-One:An entity in A is associated with atmost one entity in B and An entity in B is associated with
atmost one entity in A
One-Many: An entity in A is associated with any number of entities in B, An entity in B can be
associated with atmost one entity in A
Many-One: An entity in A is associated with atmost one entity in B, An entity in B is associated with
any number of entities in A
Many-Many: An entity in A is associated with any number of entities in B, An entity in B is associated
with any number of entities in A
1 a 1 a 1 a 1 a
2 b b
2 b 2 b 2
c 3 3
1---1 1----many many—1 many-many
Object oriented model
It is based on a collection of objects.An object contains values stored in instance variable within
the object.An object also contains bodies of code are called methods.objects that contain the same types
of values and the same methods are grouped together into classes.A class may be viewed as a type
definition for objects.
2.Record based Logical model
These models are used in describing data at the logical and view levels.Database is structured in
fixed-format records of several types.Each record type defines a fixed number of fields or attributes
and each field is usually of fixed length.
The three widely accepted record based data models are the relational,network and hierarchical
models.
Relational model:
It uses a collection of tables to represent both data and the relationship among those data .each table
has multiple column and each column has a unique name.
Regno Name Place mark
100 Raju Calicut 45
101 Vinu Malappuram 55
102 Manu Thrissur 30
103 Manu Calicut 35
Network model:
Data in the network model are represented by collection of records and relationship among data are
represented by links which can be viewed as pointers.
Store
order items
Heirarchical model:
Data and relationship among data are represented by links and records.It differ from the network
model is that the records are organized as collection of trees rather than arbitrary graph.
company
dept supplier
employe projects
3.Physical Data model:
These are used to describe at the lowest level.two types are unifying and frame memory model
Data Abstarction:
Hiding of unwanted data in database system is called Abstraction.
Levels of Abstraction
1.Physical level:It is the lowest level of abstraction to describe how data actually stored in database.
2.Logical level:It is the next higher level of abstraction.To describe what data and what relationship
exist among those data.
3.View level:It is the highest level of abstraction.It is only part of entire database.The entire
relationship among these three level of abstraction.
View1 View2 View n
View level
Logical level
Physical level
Instance and Schema:
Collection of information stored in a database particular moment is called instance.
The overall design of database is called Schema.Database system have several schema.lowest level
physical schema,intermediate level is logical schema and highest level is sub schema.Database system
support one physical schema,one logical schema and several sub schema.
Data Independence:
The ability to modify a schema definition in one level without affecting a schema definition in
next higher level is called data independence.There are two types of data independence.
1.Physical data independence:
It is the ability to modify a schema definition in physical level without affecting a schema
definition in Logical level.
2.Logical data independence:
It is the ability to modify a schema definition in logical level without affecting a schema
definition in view level.It is more difficult to achieve than physical data independence.
Database Language:
A database system provides two different types of language .One to specify the database schema and
the other to express database queries and updates.
1.Data definition language(DDL)
A database schema is specified by a set of definitions expressed by a special language called
DDL.The result of compilation of DDL statement is a set of tables that is stored in a special file called
data dictionary .A data dictionary is a file that contain meta data that is data about data.
Create: It is used to create table in the database.
Alter: It is used to alter the structure of the database.
Drop: It is used to delete table from the database.
Truncate: It is used to remove all records from a table.
Rename: It is used to rename an table.
2.Data Manipulation language(DML)
Data manipulation means retrieval of information stored in the database,insertion of new
information into the database,deletion of information from the database,modification of information
stored in the database.
Select: It is used to retrieve data from a database.
Insert: It is used to insert data into a table.
Update: It is used to update existing data within a table.
Delete: It is used to delete all records from a table.
A DML is a language that enables users to access or manipulate data as organized by the appropriate
data model. Two types of DML are Procedural DML and Non procedural DML
Procedural DML requires a user to specify what data are needed and how to get those data.
Non procedural DML require a user to specify what data are needed without specifying how to
get those data.
3. Data Control Language(DCL)
Data control language are the commands to grant and take back authority from any database user.
Grant: It is used to give user access privileges to a database.
Revoke: It is used to take back permissions from the user
4. Transaction Control Language (TCL):
TCL is a language which manages the transactions within the database. It is used to execute the
changes made by the data manipulation language statements.
The TCL commands are: Commit, Rollback.
Components of DBMS
The database management system can be divided into five major components, they are:
1.Hardware
2.Software
3.Data:
Metadata is data about the data. This is information stored by the DBMS to better understand
the data stored in it.For example: When I store my Name in a database, the DBMS will store when the
name was stored in the database, what is the size of the name, is it stored as related data to some other
data, or is it independent, all this information is metadata.
4.Procedures:
Procedures refer to general instructions to use a database management system. This includes
procedures to setup and install a DBMS, To login and logout of DBMS software, to manage databases,
to take backups, generating reports etc.
5.Database Access Language:
Database Access Language is a simple language designed to write commands to access, insert,
update and delete data stored in any database.