Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Unit-1 PDF Full Chapter

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Unit-1

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.

For example: The college Database organizes the data about the admin, staff, students and faculty etc.

Using the database, you can easily retrieve, insert, and delete the information.
o 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.
o 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.
o It provides protection and security to the database. In the case of multiple users, it also maintains
data consistency.

Characteristics of DBMS
o It uses a digital repository established on a server to store and manage the information.
o It can provide a clear and logical view of the process that manipulates data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy state in case of failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.
o It can view the database from different viewpoints according to the requirements of the user.

Advantages of DBMS
o 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.
o Data sharing: In DBMS, the authorized users of an organization can share the data among
multiple users.
o Easily Maintenance: It can be easily maintainable due to the centralized nature of the database
system.
o Reduce time: It reduces development time and maintenance need.
o Backup: It provides backup and recovery subsystems which create automatic backup of data
from hardware and software failures and restores the data if required.
o multiple user interface: It provides different types of user interfaces like graphical user
interfaces, application program interfaces

Disadvantages of DBMS
o Cost of Hardware and Software: It requires a high speed of data processor and large memory
size to run DBMS software.
o Size: It occupies a large space of disks and large memory to run them efficiently.
o Complexity: Database system creates additional complexity and requirements.
o 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.

Application of DBMS
There are different fields where a database management system is utilized. Following are a few
applications that utilize the information base administration framework.

1. Railway Reservation System


In the rail route reservation framework, the information base is needed to store the record or information
of ticket appointments, status of train’s appearance, and flight. Additionally, if trains get late,
individuals become acquainted with it through the information base update.

2. Library Management System


There are many books in the library so; it is difficult to store the record of the relative multitude of
books in a register or duplicate. Along these lines, the data set administration framework (DBMS) is
utilized to keep up all the data identified with the name of the book, issue date, accessibility of the book,
and its writer.

3. Banking
Database the executive’s framework is utilized to store the exchange data of the client in the information
base.

4. Education Sector
Presently, assessments are led online by numerous schools and colleges. They deal with all assessment
information through the data set administration framework (DBMS). In spite of that understudy’s
enlistments subtleties, grades, courses, expense, participation, results, and so forth all the data is put
away in the information base.

5. Credit card exchanges


The database Management framework is utilized for buying on charge cards and age of month to month
proclamations.

6. Social Media Sites


We all utilization of online media sites to associate with companions and to impart our perspectives to
the world. Every day, many people group pursue these online media accounts like Pinterest, Facebook,
Twitter, and Google in addition to. By the utilization of the data set administration framework, all the
data of clients are put away in the information base and, we become ready to interface with others.

7. Broadcast communications
Without DBMS any media transmission organization can’t think. The Database the executive’s
framework is fundamental for these organizations to store the call subtleties and month to month
postpaid bills in the information base.

8. Accounting and Finance


The information base administration framework is utilized for putting away data about deals, holding
and acquisition of monetary instruments, for example, stocks and bonds in a data set.

9. E-Commerce Websites
These days, web-based shopping has become a major pattern. Nobody needs to visit the shop and burn
through their time. Everybody needs to shop through web based shopping sites, (for example, Amazon,
Flipkart, Snapdeal) from home. So all the items are sold and added uniquely with the assistance of the
information base administration framework (DBMS). Receipt charges, installments, buy data these are
finished with the assistance of DBMS.

10. Human Resource Management


Big firms or organizations have numerous specialists or representatives working under them. They store
data about worker’s compensation, assessment, and work with the assistance of an information base
administration framework (DBMS).

11. Manufacturing
Manufacturing organizations make various kinds of items and deal them consistently. To keep the data
about their items like bills, acquisition of the item, amount, inventory network the executives,
information base administration framework (DBMS) is utilized.

12. Airline Reservation System


This framework is equivalent to the railroad reservation framework. This framework additionally
utilizes an information base administration framework to store the records of flight takeoff, appearance,
and defer status.

13. Healthcare System


DBMS is used in healthcare to manage patient data, medical records, and billing information.

14. Security
DBMS provides security features to ensure that only authorized users have access to the data.

15. Telecommunication
Database Management Systems (DBMS) are essential to the telecommunications industry because they
manage enormous volumes of data on billing, customer information, and network optimization.

Types of DBMS Architecture


Database architecture can be seen as a single tier or multi-tier. But logically, database architecture is of
two types like: 2-tier architecture and 3-tier architecture.

1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user can directly
sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself.
o The 1-Tier architecture is used for development of the local application, where programmers
can directly communicate with the database for the quick response.

2-Tier Architecture 1. Two tier client /server architecture is used for application program that runs on
client side.

2.Clients are directly interacts with the database.

3.An interface called ODBC(open database connectivity) that an API that allow client side program to
call the DBMS.
Fig: 2-tier Architecture

3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server. In this architecture,
client can't directly communicate with the server.
o The application on the client-end interacts with an application server which further
communicates with the database system.
o End user has no idea about the existence of the database beyond the application server. The
database also has no idea about any other user beyond the application.
o The 3-Tier architecture is used in case of large web application.

Fig: 3-tier Architecture

Three schema Architecture 1.The overall design of the database is called the database schema.

2.The three schema architecture is also called ANSI/SPARC(American National standards Institute,
Standards Planning and requirements committee) architecture or three-level architecture.
3. The three schema architecture is also used to separate the user applications and physical database.

1. Internal Level /Internal view

o The internal level has an internal schema which describes the physical storage structure of the
database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will be stored in a block.
o The physical level is used to describe complex low-level data structures in detail.

2. Conceptual Level/ logical level


o The conceptual schema describes the design of a database at the conceptual level. Conceptual
level is also known as logical level.
o The conceptual schema describes the structure of the whole database.
o In the conceptual level, internal details such as an implementation of the data structure are
hidden.
o Programmers and database administrators work at this level.

3. External Level/ view level

o At the external level, a database contains several schemas that sometimes called as subschema.
The subschema is used to describe the different view of the database.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular user group is interested and hides
the remaining database from that user group.
o The view schema describes the end user interaction with database systems.

Data Abstraction in DBMS


The main purpose of data abstraction is to hide irrelevant data and provide an abstract view of the data.
With the help of data abstraction, developers hide irrelevant data from the user and provide them the
relevant data.

In DBMS, data abstraction is performed in layers which means there are levels of data abstraction in
DBMS that we will further study in this article. Based on these levels, the database management system
is designed.

Levels of Data Abstractions in DBMS

In DBMS, there are three levels of data abstraction, which are as follows:
1. Physical or Internal Level:

The physical or internal layer is the lowest level of data abstraction in the database management system.
It is the layer that defines how data is actually stored in the database. It defines methods to access the
data in the database. It defines complex data structures in detail, so it is very complex to understand,
which is why it is kept hidden from the end user. Data Administrators (DBA) decide how to arrange
data and where to store data. The Data Administrator (DBA) is the person whose role is to manage the
data in the database at the physical or internal level. There is a data center that securely stores the raw
data in detail on hard drives at this level.

2. Logical or Conceptual Level:

The logical or conceptual level is the intermediate or next level of data abstraction. It explains what
data is going to be stored in the database and what the relationship is between them.

It describes the structure of the entire data in the form of tables. The logical level or conceptual level is
less complex than the physical level. With the help of the logical level, Data Administrators (DBA)
abstract data from raw data present at the physical level.

3. View or External Level:

View or External Level is the highest level of data abstraction. There are different views at this level
that define the parts of the overall data of the database. This level is for the end-user interaction; at this
level, end users can access the data based on their queries.

Advantages of data abstraction in DBMS


o Users can easily access the data based on their queries.
o It provides security to the data stored in the database.
o Database systems work efficiently because of data abstraction.
Data Independence
The ability to modify a schema definition in one level without affecting a schema definition in the next
higher level is called Data Independence.
Data Independence is one of the main advantage of dbms.

There are two types of data independence:

1. Logical Data Independence


o Logical data independence refers characteristic of being able to change the conceptual schema
without having to change the external schema.
o Logical data independence is used to separate the external level from the conceptual view.
o If we do any changes in the conceptual view of the data, then the user view of the data would
not be affected.
o Logical data independence occurs at the user interface level.

2. Physical Data Independence


o Physical data independence can be defined as the capacity to change the internal schema
without having to change the conceptual schema.
o If we do any changes in the storage size of the database system server, then the Conceptual
structure of the database will not be affected.
o Physical data independence is used to separate conceptual levels from the internal levels.
o Physical data independence occurs at the logical interface level.

Fig: Data Independence


Database Languages in DBMS
o A DBMS has appropriate languages and interfaces to express database queries and updates.
o Database languages can be used to read, store and update the data in the database.

Types of Database Languages


1. Data Definition Language (DDL)
o DDL stands for Data Definition Language. It is used to define database structure or pattern.
o It is used to create schema, tables, indexes, constraints, etc. in the database.
o Using the DDL statements, you can create of the database.
o Data definition language is used to store the information of metadata like the number of tables
and schemas, their names, indexes, columns in each table, constraints, etc.

Here are some tasks that come under DDL:


o Create: It is used to create objects in the database.
o Alter: It is used to alter the structure of the database.
o Drop: It is used to delete objects from the database.
o Truncate: It is used to remove all records from a table.
o Rename: It is used to rename an object.

For example, creating a new table would be a DDL operation:


CREATE TABLE Employees (
EmployeeID int,
EmployeeName varchar(255),
Role varchar(255)
);

2. Data Manipulation Language (DML)

DML stands for Data Manipulation Language.It is used for accessing and manipulating data in a
database.
It allows user insert, delete, update, and retrieve data from the database. Dml is also known as
query language
o Select: It is used to retrieve data from a database.
o Insert: It is used to insert data into a table.
o Update: It is used to update existing data within a table.
o Delete: It is used to delete all records from a table.
INSERT INTO Employees (EmployeeID, EmployeeName, Role)

VALUES (1, 'John Doe', 'Software Developer');

3.Data Control Language (DCL)


o DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
o The DCL execution is transactional. It also has rollback parameters.
Here are some tasks that come under DCL:
o Grant: It is used to give user access privileges to a database.
o Revoke: It is used to take back permissions from the user.

4. Transaction Control Language (TCL)


TCL command are used to manage transaction in the database.
TCL is used to run the changes made by the DML statement.
The changes in the database that we made using DML command are either performed or rollbacked
using TCL.
o Commit: It is used to save the transaction on the database.
o Rollback: It is used to restore the database to original since the last Commit.
o Savepoint : savepoint command is used to temporarily save a transaction so that you can
rollback to that point whenever necessary.

Integrity Constraints
o Integrity constraints are a set of rules. It is used to maintain the quality of information.
o Integrity constraints ensure that the data insertion, updating, and other processes have to be
performed in such a way that data integrity is not affected.

Types of Integrity Constraint

1. Domain constraints
o Domain constraints can be defined as the definition of a valid set of values for an attribute.
o The data type of domain includes string, character, integer, time, date, currency, etc. The value
of the attribute must be available in the corresponding domain.

Example:

Id Name Age

101 Aman 20

102 Arun
A
103 30
I
104 karan 35

I Not allowed because name is a string attribute

A Not Allowed because age is an integer attribute

2. Entity integrity constraints

o The entity integrity constraint states that primary key value can't be null.
o This is because the primary key value is used to identify individual rows in relation and if the
primary key has a null value, then we can't identify those rows.
o A table can contain a null value other than the primary key field.

Example:

Employee ID Employee Name Employee Salary


123 kamal 30000
345 Karan 40000
567 Arun 30000
Ram 50000
Null

Null not allowed as primary key can not contain a Null Value
3. Referential Integrity Constraints

o A referential integrity constraint is specified between two tables.


o In the Referential integrity constraints, if a foreign key in Table 1 refers to the Primary Key of
Table 2, then every value of the Foreign Key in Table 1 must be null or be available in Table
2.

Example:

Employee No. Name Age D.no


1 Kamal 20 11

2 Aman 30 24

3 Arun 30
18

4 Ram 25 13

18 Not Allowed as D.No 18 is not defined as primary key of the table 2 and table 1 D.no is
a foreign key defined.

Table 2

D.no D. Location
11 Delhi
24 Uttrakhand
13 Mumbai

4. Key constraints

o Keys are the entity set that is used to identify an entity within its entity set uniquely.
o An entity set can have multiple keys, but out of which one key will be the primary key.
o A primary key can contain a unique and null value in the relational table.
Example:

ID NAME SEM AGE

101 Kamal 1st 17

102 Karan 2nd 24

103 Ravi 2nd 21

104 Ram 3rd 19

Aman 1st 22
102

102 Not Allowed because all value of primary key must be Unique

Relational Model in DBMS

Relational model can represent as a table with columns and rows. Each row is known as a tuple. Each
table of the column has a name or attribute.

Domain: It contains a set of atomic values that an attribute can take.

Attribute: It contains the name of a column in a particular table. Each attribute Ai must have a domain.

Relational instance: In the relational database system, the relational instance is represented by a finite
set of tuples. Relation instances do not have duplicate tuples.

Relational schema: A relational schema contains the name of the relation and name of all columns or
attributes.

Relational key: In the relational key, each row has one or more attributes. It can identify the row in the
relation uniquely.

Example:

In the given table, NAME, ROLL_NO, PHONE_NO, ADDRESS, and AGE are the attributes.

o The instance of schema STUDENT has 5 tuples.


o t3 = <Laxman, 33289, 8583287182, Gurugram, 20>

Properties of Relations

o Name of the relation is distinct from all other relations.


o Each relation cell contains exactly one atomic (single) value
o Each attribute contains a distinct name
o Attribute domain has no significance
o tuple has no duplicate value
o Order of tuple can have a different sequence.

You might also like