You are on page 1of 12

Subject : Database Management System Subject Code : U2CCE3

Class : II B.Com CA(R)


Unit 1
Introduction to Database Management System (DBMS) – Characteristics of data in
a database – Database Management System –Need for database management system –
Types of database management systems – Hierarchical model – Network model –
Relational model – RDBMS Terminology – The Relational Data Integrity – Codd‟s Rules

Components of database
A database system is composed of four components;
• Data
• Relationships
• Constraints
• Schema
1) Data:
Data becomes information when it is processed, turning it into something meaningful.
User Data - It consists of a table(s) of data called Relation(s) where Column(s) are called
fields of attributes and rows are called Records for tables. A Relation must be structured
properly.
 Metadata - A description of the structure of the database is known as Metadata. It
basically means "data about data". System Tables store the Metadata which includes.
- Number of Tables and Table Names
- Number of fields and field Names
- Primary Key Fields
Application Metadata - It stores the structure and format of Queries, reports and other
applications components. '
2) Relationship:
Correspondence between the various data elements
3) Constraints:
Are predicates that define correct database items
4) Schema:
The organization of data and relationship within the database
The overall description of the database is called the database schema. It can be
categorized into three parts. 
1. Internal Level
2. Conceptual or Logical Level
3. External or View level
Internal Level/Schema
 The internal schema defines the physical storage structure of the database.
 The internal schema is a very low-level representation of the entire database.
 It contains multiple occurrences of multiple types of internal record.
 In the ANSI term, it is also called "stored record'.
Conceptual Schema/Level
 The conceptual schema describes the Database structure of the whole database
for the community of users.
 This schema hides information about the physical storage structures and focuses
on describing data types, entities, relationships, etc.
 This logical level comes between the user level and physical storage view.
However, there is only single conceptual view of a single database.
External Schema/Level
 An external schema describes the part of the database which specific user is
interested in. It hides the unrelated details of the database from the user. There
may be "n" number of external views for each database.
 Each external view is defined using an external schema, which consists of
definitions of various types of external record of that specific view.
 An external view is just the content of the database as it is seen by some specific
particular user. For example, a user from the sales department will see only sales
related data.
Database
A Database is a collection of related data organized in a way that data can be easily
accessed, managed and updated. Database can be software based or hardware based, with one
sole purpose, storing data.
Why a database:
It overcomes the deficiencies of pre-database information processing,
They are ,

 Data redundancy and inconsistency.


 Difficult in accessing data.
 Data isolation.
 Data integrity.
 Concurrent access is not possible.
 Security Problems.
Advantages of data in a database:
o Redundancy can be reduced
o Inconsistency can be avoided
o Data can be shared
o Standards can be enforced
o Security Restrictions can be applied
o Integrity can be maintained
o Conflicting requirements can be balanced
Characteristics of data in a Database :
The data in a database should have the following characteristics:
1. Data stored into Tables: Data is never directly stored into the database. Data is stored into
tables, created inside the database. DBMS also allows to have relationships between tables
which makes the data more meaningful and connected. You can easily understand what type
of data is stored where by looking at all the tables created in a database.
2. Reduced Redundancy: In the modern world hard drives are very cheap, but earlier when
hard drives were too expensive, unnecessary repetition of data in database was a big
problem. But DBMS follows Normalization which divides the data in such a way that
repetition is minimum.
3. Data Consistency: On Live data, i.e. data that is being continuously updated and added,
maintaining the consistency of data can become a challenge. But DBMS handles it all by
itself.
4. Support Multiple user and Concurrent Access: DBMS allows multiple users to work on
it(update, insert, delete data) at the same time and still manages to maintain the data
consistency.
5. Query Language: DBMS provides users with a simple Query language, using which data
can be easily fetched, inserted, deleted and updated in a database.
6. Security: The DBMS also takes care of the security of data, protecting the data from un-
authorized access. In a typical DBMS, we can create user accounts with different access
permissions, using which we can easily secure our data by restricting user access.
7. DBMS supports transactions, which allows us to better handle and manage data integrity in
real world applications where multi-threading is extensively used.
Database Management System:
A DBMS is a software that allows creation, definition and manipulation of database,
allowing users to store, process and analyze data easily. DBMS provides us with an interface or a
tool, to perform various operations like creating database, storing data in it, updating data,
creating tables in the database and a lot more.
DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users.
Here are some examples of popular DBMS used these days:
MySql
Oracle
SQL Server
IBM DB2
PostgreSQL
Amazon SimpleDB (cloud based) etc.
Advantages of DBMS:
 Segregation of application program.
 Minimal data duplicacy or data redundancy.
 Easy retrieval of data using the Query Language.
 Reduced development time and maintenance need.
 With Cloud Datacenters, we now have Database Management Systems
capable of storing almost infinite data.
 Seamless integration into the application programming languages which
makes it very easier to add a database to almost any application or website.
Services provided by DBMS:

DBMS is a piece of software that provides services for accessing a database

There are the following important functions and services provided by a DBMS:

(i) Data Storage Management: It provides a mechanism for management of permanent


storage of the data. The internal schema defines how the data should be stored by the storage
management mechanism and the storage manager interfaces with the operating system to access
the physical storage. 
(ii) Data Manipulation Management: A DBMS furnishes users with the ability to
retrieve, update and delete existing data in the database.
(iii) Data Definition Services: The DBMS accepts the data definitions such as external
schema, the conceptual schema, the internal schema, and all the associated mappings in source
form.
(iv) Data Dictionary/System Catalog Management: The DBMS provides a data
dictionary or system catalog function in which descriptions of data items are stored and which is
accessible to users. 
(v) Database Communication Interfaces: The end-user's requests for database access
are transmitted to DBMS in the form of communication messages.
(vi) Authorization / Security Management: The DBMS protects the database against
unauthorized access, either international or accidental. It furnishes mechanism to ensure that only
authorized users an access the database. 
(vii) Backup and Recovery Management: The DBMS provides mechanisms for
backing up data periodically and recovering from different types of failures. This prevents the
loss of data,
(viii) Concurrency Control Service: Since DBMSs support sharing of data among
multiple users, they must provide a mechanism for managing concurrent access to the database.
DBMSs ensure that the database kept in consistent state and that integrity of the data is
preserved.
(ix) Transaction Management: A transaction is a series of database operations, carried
out by a single user or application program, which accesses or changes the contents of the
database. Therefore, a DBMS must provide a mechanism to ensure either that all the updates
corresponding to a given transaction are made or that none of them is made. 
(x) Database Access and Application Programming Interfaces: All DBMS provide
interface to enable applications to use DBMS services. They provide data access via Structured
Query Language (SQL). The DBMS query language contains two components: (a) A Data
Definition Language (DDL) and (b) A Data Manipulation Language (DML).
Need for DBMS:
A Data Base Management System is a system software for easy, efficient and reliable data
processing and management. It can be used for:
 Creation of a database.
 Retrieval of information from the database.
 Updating the database.
 Managing a database.
It provides us with the much functionality and is more advantageous than the traditional file
system in many ways listed below:
o Controlling redundancy and inconsistency
o Efficient memory management and indexing
Concurrency control and transaction management
o Access Control and ease in accessing data
o Access Control and ease in accessing data
o Multiple User Interface
o Data scalability, expandability and flexibility
o Security
 Types of Database Management Systems:
Data Model:
A data model is a model that defines in which format the data are represented and
accessed. Data model mainly defines some of the data elements and relationships that exist
between them.
Types of Data Model
There are basically two types of data model:
1. Record based data model
2. Object based data model
1) Record based data model
When the database is organized in some fixed format of records of several than the model
is called record-based data model. A fixed number of fields, or attributes in each record type and
each field is usually of a fixed length. The three most popular record-based data models are,
1.     Hierarchical databases.
2.     Network databases.
3.     Relational databases.
1.Hierarchical Database Management System
A hierarchical database is a one in which the data elements have a one-to-many
relationship (1:N). The schema for a hierarchy has a single root. This kind of database model
uses a tree-like structure which links a number of dissimilar elements to one primary record – the
"owner" or "parent". Each record in a hierarchical database contains information about a group
of parent child relationships. The data are stored as records, each of which is a collection of
fields containing only one value. The records are connected to each other through links. The
structure implies that a record can have a data element repeated. They are very simple and fast.
Hierarchical databases were popular in early database design, in the era of mainframe computers.
Advantage: Hierarchical databases relate well to anything that works through a one-to-many
relationship. They can be accessed and updated rapidly because in this model, the data structure
is like that of a tree, and the relationships between records are defined in advance. These
databases allow easy addition and deletion of records. Data at the top of the hierarchy is accessed
with great speed.
Disadvantage: This type of database structure permits each child a relationship with only one
parent, and relationships or linkages between children are not permitted, even if they make sense
from a logical standpoint. This limitation is circumvented by a repetition of data, which adds to
the size of the database. Searching for specific data requires the DBMS to run through the entire
data from top to bottom until the required information is found, making queries very slow. The
lower the required data in the hierarchy, the longer it takes to retrieve it. Adding a new field or
record requires the entire database to be redefined.
2.Network Database Management System:
A network database model is one in which multiple member records or files are linked to
multiple owner files and vice versa. The network database model can be viewed as a net-like
form where a single element can point to multiple data elements and can itself be pointed to by
multiple data elements. The network database model allows each record to have multiple parents
as well as multiple child records, which can be visualized as a web-like structure of networked
records. By contrast, in the hierarchical model, a data member can only have many child records,
but only a single parent record.. However, instead of using a single-parent tree hierarchy, the
network model uses set theory to provide a tree-like hierarchy with the exception that child
tables are allowed to have more than one parent. It supports many-to-many relationships and can
be visualized as a cobweb or interconnected network of record.
Advantages: A Network database is conceptually simple and easy to design. The data access is
easier and more flexible as compared to a hierarchical model. It does not allow a member to exist
without a parent.  The main advantage of a network database is that it can handle more complex
data because of its many-to-many relationship. It allows for a more natural modeling of
relationships between records or entities, as opposed to the hierarchical model. Because of its
flexibility, it is easier to navigate and search for information in a network database. This kind of
database structure isolates the management programs from the complex physical data storage
details.
Disadvantages: The main disadvantage is that all the records in the database need to be
maintained using pointers, making the whole database structure very complex. The insertion,
deletion and updating operations of any record require an adjustment of a large number of
pointers. Network databases are difficult to use by first time users. Structural changes to the
database are very difficult to implement. Difficulties are encountered while making alterations to
the database because entering new data may necessitate altering the entire database.
3.Relational Databases Management System:
A relational database is one in which data is stored in the form of tables, using rows and
columns. This arrangement makes it easy to locate and access specific data within the database.
It is “relational”because the data within each table are related to each other. Tables may also be
related to other tables. In relational databases, tables or files containing data are
called relations (tuples), and are defined by rows (or records), and columns (or attributes)
referred to as fields. Each table has a key field that mainly identifies each record (row), and on
the basis of which records in different tables are related (or linked).
This kind of a relational structure makes it possible to run queries that need to retrieve
data from multiple tables simultaneously. Some of these programs support non-relational
databases, but they are primarily used for relational database management.
Currently, the relational database approach is the most popular. The older hierarchical
data management systems are being replaced by relational database management. Relational
DBMS software is available for large mainframe systems as well as workstations and personal
computers. Extended relational data models in which table entries are no longer simple values
but can be programs, text, unstructured data in the form of large binary, or in any other format
which the end user needs.
Advantages: Any data organized as tables consisting of rows and columns is much easier to
understand. Data can be stored in separate tables or files containing logically related attributes,
so that huge amounts of data are segmented, making management and retrieval easier and faster.
Different tables from which information has to be linked and extracted can be easily managed.
Security and authorization control can also be implemented more easily by moving sensitive data
in a given database to a separate relation with its own authorization controls. Data independence
is easily achieved in a relational database than in the more complicated tree or network structure.
Redundancy and replication of data can be minimized. RDBMS offers the possibility of
responding to queries by means of a language based on relational algebra and relational calculus.
It offers logical database independence i.e. data can be viewed in different ways by the different
users. Multiple users can access the database simultaneously which is not possible in other kinds
of databases. RDBMS also offers better backup and recovery options.
Disadvantages: A major constraint, and therefore disadvantage of RDBMS is its reliance on
machine performance. If the number of tables between which relationships are to be established
is large, then the performance in responding to the SQL queries is affected. The required
hardware is complex and software expensive, increasing the overall cost of implementing
RDBMS.

2) Object based data model


In the object-based data model, the database is organized in real-world objects of several
types. A number of fields or attributes are defined in each object. The two most popular object-
based data models are:
Object-Oriented Database Management System:
In object-oriented databases, all data are objects. Objects may be linked to each other by
an “is-part-of” relationship to represent larger, composite objects. For example, the data
describing a truck may be stored as a composite of a particular engine, chassis, gear box, steering
system, etc. Classes of objects may form a hierarchy in which individual objects may inherit
properties from objects higher up in the hierarchy. For example, objects of the class “motorized
vehicle” will all have an engine (a truck, a car or an airplane). Likewise, engines are also data
objects, and the engine attribute of a particular vehicle will be a link to a specific engine
object. Multimedia databases, in which voice, music, and video are stored along with the
traditional textual information, provide a justification for viewing data as objects. Such object
oriented databases are becoming increasingly important, since their structure is most flexible and
adaptable. The same is true of databases of pictures, images, photographs or maps. The future of
database technology is generally perceived to be an integration of the relational and object-
oriented database models.
Advantages: Object oriented databases combine the object oriented principle with the database
management principle to give a hybrid system that is more powerful than the conventional
relational database management system. The principles of object orientation like consistency,
isolation, durability, and atomicity are supported along with the principles of database
systems. In OODBMS, working with objects in the programming language is similar to working
with objects in the database. Each object is the database is identified by an object identifier
called the OID which is generated by the system. The OODBMS is more powerful than the
RDBMS if you are used to object oriented programming.
Disadvantages: A significant disadvantage of OODBMS is that it lacks a theoretical foundation
which makes it comparable to pre-relational systems. The use of OODBMS is relatively limited
because we do not yet have the level of experience that we have with traditional systems. There
is reluctance to the acceptance of this technology because OODBMSs are still very much geared
towards the programmer, rather than the naïve end-user. While the OODBMS is limited to a
small niche market, this problem will continue to exist. The increased functionality provided by
the OODBMS makes the system more complex than the traditional DBMSs.  Currently,
OODBMSs do not provide adequate security mechanisms – the database manager cannot grant
access rights on individual objects or classes.

ER (Entity Relational model)


The entity relational data model based on the perception of the real world that consist of a
collection of basics objects and relationships between them. It is an object-based logical model.
It is also high-level data model.

Relational Database Management System (RDBMS)


Introduction
 Dr. E.F Codd was the founder of RDBMS
 He defined RDBMS is “A Relational Model of Data for Large shared Data Banks”
RDBMS Terminology
 Relation - Table
 Tuple – Row, record
 Cardinality - Number of rows
 Attribute – column, field
 Degree – Number of columns
 Primary key – unique identifier
 Domain – set of legal values
Relational Data Structure:
 The smallest unit of data in the relational model is the individual data value
 Data values are assumed to be atomic i.e, no internal structure.
 A domain is a set of all possible data values.
 The number of attributes in a relation is called the degree of the relation.
 A relation of degree one is unary, a relation of degree two is called binary etc.
 The number of tuples (or) row in a relation is called Cardinality of the relation
Relational Data integrity
 Most of the relations have one attribute which are uniquely identify each tuple in the
relation.
 In some cases, there are more than one attribute which can uniquely identify each tuple in
the relation. This attribute is called as Candidate key i.e.,
Example
Element table
Symbol Name Atomic Melting pt. Boiling pt.
no.
A1 Aluminum 13 933 2792
Fe Iron 26 1811 3134
Ni Nickel 28 1728 3186

In this “Element table” there are 3 candidate keys such that ‘symbol’ ‘Name’ ‘and’ ‘Atomic no’.
 Every relation has at least one candidate key.
 In case of base relation one candidate key is designated as Primary key and remaining
keys are called alternate keys.
 Foreign key is an attribute (or) attribute combination of are relation whose values are
required to match those of the primary key of some other relation (table).
Shipment table
Item Quantity Destination
A1 100 Delhi
Fe 500 Delhi
Au 5 Delhi
‘Item’ of the shipment table matches the ‘symbol’ of the ‘Element table’. Therefore ‘item’ is the
‘foreign key’
Constraints for Relational Model
 Relational data model includes several types of constraints to maintain accuracy and
integrity of the data in the database.
i) Domain constraints
A domain is a set of values that may be assigned to an attribute. A domain definition
usually consists of following components: 1.Domain name 2.Meaning 3. Data type 4.Size (or)
Length 5.Allowable values (or) Allowable range.
ii) Entity integrity
 Entity integrity rule is designed to assure that every relation has primary key and the
value of primary key is valid.
 Entity integrity guarantees that every primary key attribute is non-null.
iii) Referential integrity:
 It is a rule that maintains consistency among rows of two tables.
 The rule states that the foreign key in one relation, either each foreign key value must
match a primary key value in other table (or) foreign key value must be null.
iv) Operational Constraints
 These are the constraints enforced in the database by the business rules (or) real world
limitations.
 And: “Age should be less than (or) equal to 60”.
CODD’s Rules:
Relational database is the finite collection of relations and relation in terms of domains,
attribute, associations and tuples. Dr. E.F. Codd, places relational model’s characteristics in three
broad categories.
1. Structural features that support the view of the data. They include relations and their
undergoing components, views and queries.
2. Integrity features such as entity and referential integrity and also application specific
constraints.
3. Data manipulation features for data retrieval, insertion, deletion and update.
 Codd provides a set of 12 rules which quality a database product as relation.
1. Information rule:
 All information in a relational database including table names, column names is
represent by values in tables.
 This view of data speeds design and learning process.
 Action can be taken when the constraints are violated.
 Access of data can be restricted.
2. Guaranteed Access rule:
 Every piece of data in a relational database, can be accessed by using a combination of a
table, a primary key valve that identifies the row and a column name, which identifies a
cell.
 User productivity is improved since there is no need to resort to using physical pointers
(or) address.
 It is possible to retrieve each individual piece of data stored in database by specifying the
name of the table in which it is stored the column and primary key which identifies the
cell in which it is stored.
3. Systematic Treatment of Nulls Rule:
 The RDBMS handles records that have unknown (or) inapplicable valves in predefined
fashion.
 Through the set of rules for handling nulls, user can distinguish results of the queries that
involve nulls, zeros and blanks
4. Active on-line catalog Based on the relational model
 The description of the database of its contents are database tables, it can queried on-line
via the data manipulation language.
5. Comprehensive Data sub-language rule
 RBDMS have several languages. It allows the user to do the following,
o Define tables and views
o Query and update
o Set integrity constraints
o Set authorizations.
o Define transactions.
6. View updating rule
 Any view that can be updated theoretically can be updated using the RDBMS.
 Data consistency is ensured since the changes made in the view are transmitted to the
base table and vice-versa.
7. High-level insert, update and delete
 The RDBMS supports insertion, updating and deletion at a table level.
 The performance is improved since the commands act on a set of records rather than on
one record at a time.
8. Physical Data independence
 The execution of ad hoc requests and application programs is not affected by changes in
the physical data access and storage methods.
 Data base administers can make changes to physical access and storage methods which
improve the performance.
9. Logical data independence
 Logical data changes in tables and views such as adding / deleting columns or changing
field need not necessitate modification in the program or format of adhoc requests.
10. Integrity independence
 Like table and view, integrity constraints are stored in online catalog and can therefore
changed without changes in the application programs.
11. Distribution independence
 Application programs and adhoc request are not affected by changes in the distribution of
physical data.
 This improves reliability.
12. Non-subversion rule
 If the RDBMS has a language that accesses the information of a record at-time, this
language should not be used to bypass the integrity constraints. This is necessary for data
integrity.

You might also like