0% found this document useful (0 votes)
8 views

RDBMS Unit 1 Notes

The document provides an overview of Relational Database Management Systems (RDBMS), covering key concepts such as databases, database management systems (DBMS), and their purposes. It discusses various data models, database languages, transaction management, storage management, and the roles of database administrators and users. Additionally, it explains the three-schema architecture and contrasts two-tier and three-tier architectures in database systems.

Uploaded by

sridevisengkumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

RDBMS Unit 1 Notes

The document provides an overview of Relational Database Management Systems (RDBMS), covering key concepts such as databases, database management systems (DBMS), and their purposes. It discusses various data models, database languages, transaction management, storage management, and the roles of database administrators and users. Additionally, it explains the three-schema architecture and contrasts two-tier and three-tier architectures in database systems.

Uploaded by

sridevisengkumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

RDBMS Unit 1 Notes

What is Database?

 A database is a collection of related data, so that it can be easily stored, accessed and
managed.
 In a data base system – a common data is shared by a number of applications and
program independent.
 You can organize data into tables, rows, columns, and index it to make it easier to find
relevant information from the database.
 A database can be Local, meaning that it can be used on one machine by one user only.
 A database can be distributed, meaning that the information is stored on remote
machines and can be accessed over a network. The primary advantage of using
distributed databases is that they can be accessed by multiple users at once.

Define DBMS
 A Database-Management System (DBMS) is a collection of interrelated data and a set of
programs to access those data.
 The collection of data, usually referred to as the database, contains information relevant
to an enterprise.
 Database systems are designed to manage large bodies of information.
 The primary goal of a DBMS is to provide a way to store and retrieve database
information that is both convenient and efficient.

Describe purpose of Database Systems.


The purpose of database systems is to make the database user-friendly and do easy
operations. Users can easily insert, update, and delete. Actually, the main purpose is to have
more control of the data.

The purpose of database systems is to manage the following insecurities:


1. Data redundancy and Inconsistency,
2. Difficulty in accessing data,
3. Data isolation

1
4. Atomicity of updates
5. Concurrent access
6. Security problems
7. Supports multiple views of data.

1. Avoid data redundancy and inconsistency:


If there are multiple copies of the same data, it just avoids it. It just maintains data in a single
repository. Also, the purpose of database systems is to make the database consistent.

2. Difficulty in accessing data:


A database system can easily manage to access data. Through different queries, it can access data
from the database.

3. Data isolation:
Data are isolated in several fields in the same database.

4.Atomicity of updates:
In case of power failure, the database might lose data. So, this feature will automatically prevent
data loss.

5. Concurrent access:
Users can have multiple access to the database at the same time.

6. Security problems:
Database systems will make the restricted access. So, the data will not be vulnerable.

7. Supports multiple views of data:


It can support multiple views of data to give the required view as their needs. Only database admins
can have a complete view of the database. We cannot allow the end-users to have a view of
developers.

2
Discuss View of Data.
A major purpose of a database system is to provide users with an abstract view of the data. That is,
the system hides certain details of how the data are stored and maintained. The database is highly
complex data. Developers hide the complexity of data structure which might not be familiar with the
end-users. So, they provide abstract views of data. This is called data abstraction. There are 3 levels
of abstraction. They are:

1. Physical level
2. Logical Level
3. View Level

Figure : The three levels of data abstraction / View of Data

1. Physical Level:
It is called the lowest level of abstraction or internal level. It describes how the data is actually stored
in the database. At this level, complex data structure details are shown.

2. Logical Level
It is called the middle level of abstraction or conceptual level. It describes what data is stored in a
database and also shows what relationship exists among those data.

3. View Level
It is called the highest level of abstraction or external level. It describes the user interaction with
database systems via application programs, that hide details of data types. It shows only a part of
the entire database.

3
Instance
The collection of information stored in the database at a particular moment is called an instance
of the database.

Discuss Schemas.
The overall design of the database is called the database schema. Schemas are changed
infrequently, if at all.

Database systems have several schemas, partitioned according to the levels of abstraction.
There are Three types in Schema.

1.Physical schema
2.Logical schema
3. Subschemas

 The physical schema describes the database design at the physical level.
 The logical schema describes the database design at the logical level.
 A database may also have several schemas at the view level, sometimes called
subschemas, that describe different views of the database.

Discuss Data Models.


A data models are used to describe the design of a database at the physical, logical, and view levels.
Also, Data model is a collection of conceptual tools for describing data, data relationships, data
semantics, and consistency constraints.

The data models can be classified into following types:

1. Hierarchical Model
2. Network Model
3. Entity-relationship Model
4. Relational Model.
5. Object-Based Data Model
6. Semistructured Data Model.

4
1. Hierarchical Model
 This database model organises data into a tree-like-structure, with a single root, to which all the

other data is linked. The hierarchy starts from the Root data, and expands like a tree, adding

child nodes to the parent nodes.

 In this model, a child node will only have a single parent node.

 This model efficiently describes many real-world relationships like index of a book, recipes etc.

 In hierarchical model, data is organised into tree-like structure with one one-to-many relationship

between two different types of data, for example, one department can have many courses, many

professors and of-course many students.

2. Network Model
 This is an extension of the Hierarchical model. In this model data is organised more like a graph,

and are allowed to have more than one parent node.

 In this 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 was used to map many-to-many data relationships.

 This was the most widely used database model, before Relational Model was introduced.

5
Figure : Network Model

3. Entity-relationship Model
 In this database model, relationships are created by dividing object of interest into entity and its
characteristics into attributes.
 Different entities are related using relationships.
 E-R Models are defined to represent the relationships into pictorial form to make it easier for
different stakeholders to understand.
 This model is good to design a database, which can then be turned into tables in relational
model(explained below).
 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.

6
4. Relational Model

 In this model, data is organised in two-dimensional tables and the relationship is maintained by
storing a common field.
 This model was introduced by E.F Codd in 1970, and since then it has been the most widely used
database model, infact, we can say the only database model used around the world.
 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.
 Hence, tables are also known as relations in relational model.

5. Object-Based Data Model

Object-oriented programming (especially in Java, C++, or C#) has become the dominant software-
development methodology. This led to the development of an object-oriented data model that can be
seen as extending the E-R model with notions of encapsulation, methods (functions), and object identity.
The object-relational data model combines features of the object-oriented data model and relational data
model.

6. Semistructured Data Model.

The semistructured data model permits the specification of data where individual data items of the same
type may have different sets of attributes. The Extensible Markup Language (XML) is widely used to
represent semistructured data.

7
Discuss Database languages.

SQL Commands
SQL commands are instructions. It is used to communicate with the database. It is also used to perform
specific tasks, functions, and queries of data.
SQL can perform various tasks like create a table, add data to tables, drop the table, modify the table, set
permission for users.

Types of SQL Commands


There are five types of SQL commands: DDL, DML, DCL, TCL, and DQL.

Data Definition Language (DDL)


DDL changes the structure of the table like creating a table, deleting a table, altering a table, etc.
All the command of DDL are auto-committed that means it permanently save all the changes in the
database.

8
There are two CREATE statements available in SQL:
CREATE DATABASE
CREATE TABLE

The CREATE DATABASE statement is used to create a new database in SQL.


Syntax:

CREATE DATABASE database_name;

Example Query:
CREATE DATABASE II_B.COM_CA;

CREATE TABLE

The CREATE TABLE statement is used to create a table in SQL. We know that a table comprises of
rows and columns. So while creating tables we have to provide all the information to SQL about the
names of the columns, type of data to be stored in columns, size of the data.

syntax:

CREATE TABLE table_name


(
column1 data_type(size),
column2 data_type(size),
column3 data_type(size),
);

Example Query:
This query will create a table named Students with three columns, ROLL_NO, NAME and SUBJECT.

CREATE TABLE Students


(
ROLL_NO int(3),

9
NAME varchar(20),
ADDRESS varchar(50),
);

DROP: It is used to delete both the structure and record stored in the table.
Syntax
DROP TABLE table_name;

Example
DROP TABLE Students;

ALTER: It is used to alter the structure of the TABLES.

Syntax:
To add a new column in the table

ALTER TABLE table_name ADD column_name COLUMN-definition;

ALTER TABLEStudents ADD column_name MOBILE INT(10);

ALTER TABLE STU_DETAILS MODIFY (NAME VARCHAR2(30));

TRUNCATE: It is used to delete all the rows from the table and free the space containing the table.
Syntax:

TRUNCATE TABLE table_name;


Example:

TRUNCATE TABLE EMPLOYEE;

10
Discuss Transaction Management.

 A transaction is a collection of operations that performs a single logical function in a database


application.
 Transaction-management component ensures that the database remains in a consistent (correct)
state despite system failures (e.g., power failures and operating system crashes) and
 transaction failures
 .Ensuring the atomicity and durability properties is the responsibility of the database system
itself—specifically, of the recovery manager.
 So, The database system must therefore perform Failure Recovery, that is, detect system
failures and restore the database to the state that existed prior to the occurrence of the failure.
 Concurrency-control Manager controls the interaction among the concurrent transactions, to
ensure the consistency of the database.
 The Transaction Manager consists of the concurrency-control manager and the recovery
manager to govern the database Transaction activities.

Discuss Storage Management.


Storage manager is a program module that provides the interface between the low-level data
stored in the database and the application programs and queries submitted to the system.
The storage manager is responsible to the following tasks:
 Interaction with the file manager
 Efficient storing, retrieving and updating of data

The storage manager has the following Four components:


1. Authorization and integrity manager
2. Transaction manager
3. File manager
4. Buffer manager

1. Authorization and integrity manager


Authorization and integrity manager, which tests for the satisfaction of integrity constraints and
checks the authority of users to access data.

11
2. Transaction manager
It ensures that the database remains in a consistent (correct) state despite system failures, and
that concurrent transaction executions proceed without conflicting.

3. File manager
It manages the allocation of space on disk storage and the data structures used to represent
information stored on disk.

4. Buffer manager
It is responsible for fetching data from disk storage into main memory, and deciding what data
to cache in main memory. The buffer manager is a critical part of the database system, since it
enables the database to handle data sizes that are much larger than the size of main memory.

Discuss about the Duties of Database Administrator.


Coordinates all the activities of the database system; the database administrator has a good
understanding of the enterprise’s information resources and needs.
Database administrator's duties include:
 Schema definition
 Storage structure and access method definition
 Schema and physical organization modification
 Granting user authority to access the database
 Specifying integrity constraints
 Acting as liaison with users
 Monitoring performance and responding to changes in requirements

Database Users
 Users are differentiated by the way they expect to interact with the system
 Application programmers – interact with system through DML calls
 Sophisticated users – form requests in a database query language
 Specialized users – write specialized database applications that do not fit into the
traditional data processing framework
 Naïve users – invoke one of the permanent application programs that have been written
previously
E.g. people accessing database over the web, bank tellers, clerical Staff

12
Discuss Three-Schema Architecture.
The goal of the three-schema architecture is to separate the user applications and the physical
database. In this architecture, schemas can be defined at the following three levels:
1. Internal Level Schema
2. Conceptual Level Schema
3. External or View Level Schema

Figure - Three-Schema Architecture

1. Internal Level Schema


It describes the physical storage structure of the database. The internal schema uses a physical
data model and describes the complete details of data storage and access paths for the database.

2. Conceptual Level Schema


It describes the structure of the whole database for a community of users (Programmers). The
conceptual schema hides the details of physical storage structures and concentrates on describing
entities, data types, relationships, user operations, and constraints.

3. External or View Level Schema


The external or view level includes a number of external schemas or user views. Each external
schema describes the part of the database that a particular user group is interested in and hides
the rest of the database from that user group.

13
Discuss Two-Tier Architecture and Three Tier Architecture.

Two-Tier Architecture

In a two-tier architecture, the application resides at the client machine, where it invokes database

system functionality at the server machine through query language statements. Application

program interface standards like ODBC and JDBC are used for interaction between the client and

the server.

Three-Tier Architecture

In contrast, in a three-tier architecture, the client machine acts as merely a front end and does not

contain any direct database calls. Instead, the client end communicates with an application server,

usually through a forms interface. The application server in turn communicates with a database

system to access data. Three-tier applications are more appropriate for large applications, and

for applications that run on the World Wide Web.

Figure - Two-tier and Three-tier Architectures.

14
Describe Database System Architecture in detail.
 A database system is partitioned into modules that deal with each of the responsibilities
of the overall system.
 The functional components of a database system can be broadly divided into the storage
manager and the query processor components.
 The storage manager is important because databases typically require a large amount of
storage space. The query processor is important because it helps the database system
simplify and facilitate access to data.

Query Processor:
The Query Processor consists of DDL Interpreter, DML Compiler, Query evaluation engine.

DDL interpreter
It interprets DDL statements and records the definitions in the data dictionary.

DML compiler,
 It translates DML statements in a query language into an evaluation plan consisting of
low-level instructions that the query evaluation engine understands.
 The DML compiler also performs query optimization, that is, it picks the lowest cost
evaluation plan from among the alternatives.

Query evaluation engine


It executes low-level instructions generated by the DML compiler.

Storage Manager:
A storage manager is a program module that provides the interface between the low level data
stored in the database and the application programs and queries submitted to the system. The
storage manager is
responsible for the interaction with the file manager.
.
The storage manager components include:
1. Authorization and integrity manager

15
It tests for the satisfaction of integrity constraints and checks the authority of users to access data.

2. Transaction manager
It ensures that the database remains in a consistent (correct) state despite system failures, and
that concurrent transaction executions proceed without conflicting.

3. File manager
It manages the allocation of space on disk storage and the data structures used to represent
information stored on disk.

4· Buffer manager
It is responsible for fetching data from disk storage into main memory, and deciding what data to
cache in main memory. The buffer manager is a critical part of the database system, since it
enables the database to handle data sizes that are much larger than the size of main memory.

Transaction Manager:
A transaction is a collection of operations that performs a single logical function in a database
application. If the database was consistent when a transaction started, the database must be
consistent when the transaction successfully terminates. Transaction - manager ensures that the
database remains in a consistent (correct) state despite system failures (e.g., power failures and
operating system crashes) and transaction failures.

16
Figure : Overall System Architecture

Discuss Database-System Applications

Databases are widely used. Here are some representative applications:

1. Enterprise Information

 Sales: For customer, product, and purchase information.


 Accounting: For payments, receipts, account balances, assets and other accounting
information.
 Human resources: For information about employees, salaries, payroll taxes, and
benefits, and for generation of paychecks.

17
 Manufacturing: For management of the supply chain and for tracking production of items
in factories, inventories of items in warehouses and stores, and orders for items.
 Online retailers: For sales data noted above plus online order tracking, generation of
recommendation lists, and maintenance of online product evaluations.

2. Banking and Finance


 Banking: For customer information, accounts, loans, and banking transactions.
 Credit card transactions: For purchases on credit cards and generation of
 monthly statements.
 Finance: For storing information about holdings, sales, and purchases of financial
instruments such as stocks and bonds; also for storing real-time market data to enable
online trading by customers and automated trading by the firm.

3. Universities:
For student information, course registrations, and grades (in addition to standard enterprise
information such as human resources and accounting).
4. Airlines:
For reservations and schedule information. Airlines were among the first to use databases in a
geographically distributed manner.
5 Telecommunication:
For keeping records of calls made, generating monthly bills, maintaining balances on prepaid
calling cards, and storing information about the communication networks.

18

You might also like