RDBMS Unit-1
RDBMS Unit-1
RDBMS
Introduction to Database Management System
Characteristics of database approach
Advantages of DBMS
Schemas: Three schema architecture - The external level, the conceptual level
and the internal level.
Data Independence
Database languages and Interfaces
Roles of Database Administrator
Introduction to Data Models (Hierarchical, Network and Relation)
Entity type, Entity sets, Attributes and keys.
The ER Model: `
# INTRODUCTION TO DBMS
The database is a collection of inter-related data which is used to retrieve, insert and delete the data
efficiently. It is also used to organize the data in the form of a table, schema, views, and reports, etc.
Some Other Definitions are-
Database management system is a software which is used to manage the database. For
example: MySQL, Oracle, etc are a very popular commercial database which is used in
different applications.
DBMS provides an interface to perform various operations like database creation,
storing data in it, updating data, creating a table in the database and a lot more.
It provides protection and security to the database. In the case of multiple users, it also
maintains data consistency.
1
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
Characteristics of DBMS
1. It uses a digital repository established on a server to store and manage the
information.
2. It can provide a clear and logical view of the process that manipulates data.
3. DBMS contains automatic backup and recovery procedures.
4. It contains ACID properties which maintain data in a healthy state in case of failure.
5. It can reduce the complex relationship between data.
6. It is used to support manipulation and processing of data.
7. It is used to provide security of data.
8. It can view the database from different viewpoints according to the requirements of
the user.
Advantages of DBMS
1. Controls database redundancy: It can control data redundancy because it stores all
the data in one single database file and that recorded data is placed in the database.
2. Data sharing: In DBMS, the authorized users of an organization can share the data
among multiple users.
3. Easily Maintenance: It can be easily maintainable due to the centralized nature of
the database system.
4. Reduce time: It reduces development time and maintenance need.
5. Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and software failures and restores the data if
required.
6. multiple user interface: It provides different types of user interfaces like graphical
user interfaces, application program interfaces
Disadvantages of DBMS
1. Cost of Hardware and Software: It requires a high speed of data processor and
large memory size to run DBMS software.
2. Size: It occupies a large space of disks and large memory to run them efficiently.
3. Complexity: Database system creates additional complexity and requirements.
4. Higher impact of failure: Failure is highly impacted the database because in most
of the organization, all the data stored in a single database and if the database is
damaged due to electric failure or database corruption then the data may be lost
forever.
2
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
#TYPES OF DATABASES
There are various types of databases used for storing different varieties of data:
1) Centralized Database
It is the type of database that stores data at a centralized database system. It comforts the users to
access the stored data from different locations through several applications. These applications
contain the authentication process to let users access data securely. An example of a Centralized
database can be Central Library that carries a central database of each library in a
college/university.
Advantages of Centralized Database
It has decreased the risk of data management, i.e., manipulation of data will not affect the
core data.
Data consistency is maintained as it manages data in a central repository.
It provides better data quality, which enables organizations to establish data standards.
It is less costly because fewer vendors are required to handle the data sets.
Disadvantages of Centralized Database
The size of the centralized database is large, which increases the response time for fetching
the data.
It is not easy to update such an extensive database system.
If any server failure occurs, entire data will be lost, which could be a huge loss.
2) Distributed Database
Unlike a centralized database system, in distributed systems,
data is distributed among different database systems of an
organization. These database systems are connected via
communication links. Such links help the end-users to access
the data easily. Examples of the Distributed database are
Apache Cassandra, HBase, Ignite, etc.
1. Homogeneous DDB: Those database systems which
execute on the same operating system and use the same
application process and carry the same hardware devices.
2. Heterogeneous DDB: Those database systems which
execute on different operating systems under different
application procedures, and carries different hardware
devices.
3
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
3) Relational Database
This database is based on the relational data model, which stores data in the form of rows(tuple) and
columns(attributes), and together forms a table(relation). A relational database uses SQL for storing,
manipulating, as well as maintaining the data. E.F. Codd invented the database in 1970. Each table
in the database carries a key that makes the data unique from others. Examples of Relational
databases are MySQL, Microsoft SQL Server, Oracle, etc.
Properties of Relational Database
There are following four commonly known properties of a relational model known as ACID
properties, where:
A means Atomicity: This ensures the data operation will complete either with success or
with failure. It follows the 'all or nothing' strategy. For example, a transaction will either be
committed or will abort.
C means Consistency: If we perform any operation over the data, its value before and after
the operation should be preserved. For example, the account balance before and after the
transaction should be correct, i.e., it should remain conserved.
I means Isolation: There can be concurrent users for accessing data at the same time from
the database. Thus, isolation between the data should remain isolated. For example, when
multiple transactions occur at the same time, one transaction effects should not be visible to
the other transactions in the database.
D means Durability: It ensures that once it completes the operation and commits the data,
data changes should remain permanent.
4) NoSQL Database
Non-SQL/Not Only SQL is a type of database that is used for
storing a wide range of data sets. It is not a relational database as it
stores data not only in tabular form but in several different ways. It
came into existence when the demand for building modern
applications increased. Thus, NoSQL presented a wide variety of
database technologies in response to the demands.
4
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
5) Cloud Database
A type of database where data is stored in a virtual environment and executes over the cloud
computing platform. It provides users with various cloud computing services (SaaS, PaaS, IaaS, etc.)
for accessing the database. There are numerous cloud platforms, but the best options are:
Amazon Web Services(AWS)
Microsoft Azure
Kamatera
PhonixNAP
ScienceSoft
Google Cloud SQL, etc.
6) Object-oriented Databases
The type of database that uses the object-based data model approach for storing data in the
database system. The data is represented and stored as objects which are similar to the objects used
in the object-oriented programming language.
7) Hierarchical Databases
It is the type of database that stores data in the form of
parent-children relationship nodes. Here, it organizes
data in a tree-like structure.
8) Network Databases
It is the database that typically follows the network data model. Here, the representation of data is in
the form of nodes connected via links between them. Unlike the hierarchical database, it allows each
record to have multiple children and parent nodes to form a generalized graph structure.
9) Personal Database
Collecting and storing data on the user's system defines a Personal Database. This database is
basically designed for a single user.
Advantage of Personal Database
It is simple and easy to handle.
It occupies less storage space as it is small in size.
5
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
#DATABASE SCHEMA
A database schema is the logical representation of a database, which shows how the data is
stored logically in the entire database. It contains list of attributes and instruction that
informs the database engine that how the data is organized and how the elements are related
to each other.
A database schema contains schema objects that may include tables, fields, packages,
views, relationships, primary key, foreign key,
In actual, the data is physically stored in files that may be in unstructured form, but to
retrieve it and use it, we need to put it in a structured form. To do this, a database schema is
used. It provides knowledge about how the data is organized in a database and how it is
associated with other data.
The schema does not physically contain the data itself; instead, it gives information
about the shape of data and how it can be related to other tables or models.
A database schema object includes the following:
Consistent formatting for all data entries.
Database objects and unique keys for all data entries.
Tables with multiple columns, and each column contains its name and datatype.
The complexity & the size of the schema vary as per the size of the project. It helps developers
to easily manage and structure the database before coding it.
6
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
At this level, programmers and administrators work, and the implementation of the data structure is
hidden at this level. Various tools are used to create a logical database schema, and these tools
demonstrate the relationships between the component of your data; this process is called ER
modelling. The ER modelling stands for entity-relationship modelling, which specifies the
relationships between different entities.
3. View Schema
The view level design of a database is known as view schema. This schema generally describes the
end-user interaction with the database systems. User is able to interact with the database with the
help of the interface without knowing much about the stored mechanism of data in database.
It contains both primary & secondary Keys. It also contains both primary & secondary keys.
It contains the column names and their data It does not contain any column name or
types. datatype.
# DATA INDEPENDENCE
Data Independence is mainly defined as a property of DBMS that helps you to change the database
schema at one level of a system without requiring changing the schema at the next level. It helps to
keep the data separated from all programs that makes use of it.
We have namely two levels of data independence arising from these levels of abstraction:
Physical level data independence
Logical level data independence
7
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
Changing from sequential to random access files is one such example. These alterations or
modifications to the physical structure may include:
Utilizing new storage devices.
Modifying data structures used for storage.
Altering indexes or using alternative file organization techniques etc.
# INTERFACES IN DBMS
A database management system (DBMS) interface is a user interface that allows for the ability to
input queries to a database without using the query language itself. User-friendly interfaces provided
by DBMS may include the following:
a) Menu-Based Interfaces
b) Forms-Based Interfaces
c) Graphical User Interfaces
d) Natural Language Interfaces
e) Speech Input and Output Interfaces
f) Interfaces for Parametric Users
g) Interfaces for the Database Administrator (DBA)
a) Menu-Based Interfaces
These interfaces present the user with lists of options (called menus) that lead the user through the
formation of a request. The basic advantage of using menus is that they remove the tension of
remembering specific commands and syntax of any query language. The query is basically composed
step by step by collecting or picking options from a menu that is shown by the system. Pull-down
menus are a very popular technique in Web-based interfaces. They are also often used in browsing
interfaces which allow a user to look through the contents of a database in an exploratory and
unstructured manner.
b) Forms-Based Interfaces
A forms-based interface displays a form to each user. Users can fill out all of the form entries to
insert new data, or they can fill out only certain entries, in which case the DBMS will redeem the
same type of data for other remaining entries. These types of forms are usually designed or created
and programmed for users that have no expertise in operating systems. Many DBMS’s have form
specification languages which are special languages that help specify such forms.
8
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
#DATABASE LANGUAGES
Database Language is a particular type of programming language used to define and manipulate a
database. Based on their application, database languages are classified into four types: DDL, DML,
DCL, and TCL. Database languages are used to perform various critical tasks that help a database
management system function correctly.
Why SQL?
SQL is widely popular because it offers the following advantages −
Allows users to access data in the relational database management systems.
Allows users to describe the data.
Allows users to define the data in a database and manipulate that data.
Allows to embed within other languages using SQL modules, libraries & pre-compilers.
Allows users to create and drop databases and tables.
Allows users to create view, stored procedure, functions in a database.
Allows users to set permissions on tables, procedures and views.
9
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
10
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
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.
11
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
12
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
# DATA MODELS
Data models define how the logical structure of a database is modelled. Data models define how data
is connected to each other and how they are processed inside the system. It defines how data will be
stored, accessed, and updated in a database management system. It's like creating a blueprint of
your Database. It defines the data elements and the relationships between the data elements.
13
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
14
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
#HIERARCHICAL MODEL
The hierarchical Model is one of the oldest models in the data model which was developed by IBM, in
the 1950s. In a hierarchical model, data are viewed as a collection of tables, or we can say segments
that form a hierarchical relation. In this, the data is organized into a tree-like structure where each
record consists of one parent record and many children. Even if the segments are connected as a
chain-like structure by logical associations, then the instant structure can be a fan structure with
multiple branches. We call the illogical associations as directional associations.
#NETWORK MODEL
The Network Model was formalized by the Database Task group in the 1960s. This model is the
generalization of the hierarchical model. This model can consist of multiple parent segments and
these segments are grouped as levels but there exists a logical association between the segments
belonging to any level. Mostly, there exists a many-to-many logical association between any of the
two segments. In this model, data is organized more like a graph, and allowed to have more than one
parent node. In the network database model, data is more related as more relationships are
established in this database model. Also, as the data is more related, hence accessing the data is
also easier and fast. This database model uses many-to-many data relationships. Integrated Data
Store (IDS) is based on this database model. This was the most widely used database model before
Relational Model was introduced. The implementation of the Network model is complex, and it's very
difficult to maintain it.
15
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
# RELATIONAL MODEL
Relational Data Model uses tables to represent the data and the relationship among these data. Each
table has multiple columns and each column is identified by a unique name. It is a low-level model.
This model was introduced by E.F Codd in 1970, and since then it has been the most widely used
database model. The basic structure of data in the relational model is tables. All the information
related to a particular type is stored in rows of that table. You can design tables, normalize them to
reduce data redundancy, and use Structured Query language or SQL to access data from the tables.
Some of the most popular databases are based on this database model. For example Oracle, MySQL
etc.
16
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
Entities
An entity can be a real-world object, either animate or inanimate, that can be easily identifiable. For
example, in a school database, students, teachers, classes, and courses offered can be considered as
entities. All these entities have some attributes or properties that give them their identity. An entity
set is a collection of similar types of entities. An entity set may contain entities with attribute sharing
similar values.
For example: In the following ER diagram we have two entities Student and College and these two
entities have many to one relationship as many students study in a single college. We will read more
about relationships later, for now focus on entities.
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the relationship with
other entity is called weak entity. The weak entity is represented by a double rectangle. For example
– a bank account cannot be uniquely identified without knowing the bank to which the account
belongs, so bank account is a weak entity.
17
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
Attributes
Entities are represented by means of their properties, called attributes. All attributes have values.
For example, a student entity may have name, class, and age as attributes.
There exists a domain or range of values that can be assigned to attributes. For example, a student's
name cannot be a numeric value. It has to be alphabetic. A student's age cannot be negative, etc.
Types of Attributes
Simple attribute − Simple attributes are atomic values, which cannot be divided further. For
example, a student's phone number is an atomic value of 10 digits.
Key attribute- A key attribute can uniquely identify an entity from an entity set. For
example, student roll number can uniquely identify a student from a set of students. Key
attribute is represented by oval same as other attributes however the text of key attribute is
underlined.
Composite attribute − Composite attributes are made of more than one simple attribute. For
example, a student's complete name may have first_name, middle_name and last_name.
Derived attribute − Derived attributes are the attributes that do not exist in the physical
database, but their values are derived from other attributes present in the database. For
example, average_salary in a department should not be saved directly in the database,
instead it can be derived. For another example, age can be derived from data_of_birth.
18
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
Multi-value attribute − Multi-value attributes may contain more than one values. For
example, a person can have more than one phone number, email_address, etc.
Relationship
Relationships are represented by diamond-shaped box. Name of the relationship is written inside the
diamond-box. All the entities (rectangles) participating in a relationship, are connected to it by a line.
Binary Relationship and Cardinality
A relationship where two entities are participating is called a binary relationship. Cardinality is the
number of instance of an entity from a relation that can be associated with the relation.
One-to-one − When only one instance of an entity is associated with the relationship, it is
marked as '1:1'. The following image reflects that only one instance of each entity should be
associated with the relationship. It depicts one-to-one relationship.
One-to-many − When more than one instance of an entity is associated with a relationship, it
is marked as '1:N'. The following image reflects that only one instance of entity on the left and
more than one instance of an entity on the right can be associated with the relationship. It
depicts one-to-many relationship.
19
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
Many-to-one − When more than one instance of entity is associated with the relationship, it
is marked as 'N:1'. The following image reflects that more than one instance of an entity on
the left and only one instance of an entity on the right can be associated with the
relationship. It depicts many-to-one relationship.
Many-to-many − The following image reflects that more than one instance of an entity on the
left and more than one instance of an entity on the right can be associated with the
relationship. It depicts many-to-many relationship.
20
Faculty of : FCE. Program: BTech Class/Section: 4 F / J Date: ……………………….
Name of Faculty: Dr. S.K.Kapoor Name of Course: RDBMS Code: BCECCE4103
21