Professional Documents
Culture Documents
Unit 1
Unit 1
MySQL
- PostgreSQL
- Microsoft Access
- SQL Server
- File Maker
- Oracle
- RDBMS
- dBASE
- Clipper
- FoxPro
Features of DBMS
Data modeling: A DBMS provides tools for creating and modifying data models, which
define the structure and relationships of the data in a database.
Data storage and retrieval: A DBMS is responsible for storing and retrieving data from
the database, and can provide various methods for searching and querying the data.
Concurrency control: A DBMS provides mechanisms for controlling concurrent access to
the database, to ensure that multiple users can access the data without conflicting with each
other.
Data integrity and security: A DBMS provides tools for enforcing data integrity and
security constraints, such as constraints on the values of data and access controls that
restrict who can access the data.
Backup and recovery: A DBMS provides mechanisms for backing up and recovering the
data in the event of a system failure.
Database Languages
1)Data Definition Language
2)Data Manipulation Language
3)Data Control Language
4)Transactional Control Language
Online shopping: To save time online shopping is helpful. Present days online shopping
created a trend. People love to do online shopping through websites like Amazon, Flipkart.
All the transactions such as products added, the products sold, generation of invoice bills,
payments happen with the help of DBMS.
What is Database
A database is a collection of data that is organized, which is also called structured data. It
can be accessed or stored in a computer system. It can be managed through a
Database Management System (DBMS), a software used to manage data. Database refers
to related data in a structured form.
Types of Databases
Relational Databases: A relational database’s contents are arranged as a collection of
tables with rows and columns. Accessing structured data is made most flexible and
efficient by relational database technology.
Object-Oriented Databases: Similar to object-oriented programming, data in an object-
oriented database is represented as objects.
Distributed Databases: A distributed database is made up of two or more files that are
spread across multiple locations. The database could be dispersed across many networks,
housed in one physical place, or kept on several computers.
Data Warehouses: A data warehouse is a sort of database created especially for quick
query and analysis. It is a central repository for data.
NoSQL Databases: Unlike relational databases, which specify how all data input must be
formatted, NoSQL, or nonrelational databases, permit the storing and manipulation of
unstructured and semistructured data. The prevalence and complexity of online
applications led to the rise in popularity of NoSQL databases.
Graph Databases: Data is stored in a graph database using entities and their relationships.
Need for DBMS
1.Data Organization and Management
2.Data Security and Privacy
3.Data Integrity and Consistency
4.Concurrent Data Access
5.Data Analysis and Reporting
6.Scalability and Flexibility
7.Cost-Effectiveness
1. Data Organization and Management:
One of the primary needs for a DBMS is data organization and management. DBMSs
allow data to be stored in a structured manner, which helps in easier retrieval and analysis.
A well-designed database schema faster access to information, reducing the time required
to find relevant data.
A DBMS also provides features like indexing and searching, which make it easier to locate
specific data within the database. This allows organizations to manage their data more
efficiently and effectively.
2. Data Security and Privacy:
DBMSs provide a robust security framework that ensures the confidentiality, integrity, and
availability of data. They offer authentication and authorization features that control access
to the database.
3. Data Integrity and Consistency:
Data integrity and consistency are for any database. DBMSs provide mechanisms that
ensure the accuracy and consistency of data. These mechanisms include constraints,
triggers, and stored procedures that enforce data integrity rules. DBMSs also provide
features like transactions that ensure that data changes are atomic, consistent, isolated, and
durable (ACID).
4. Concurrent Data Access:
A DBMS provides a concurrent access mechanism that allows multiple users to access the
same data simultaneously. This is especially important for organizations that require real-
time data access. DBMSs use locking mechanisms to ensure that multiple users can access
the same data without causing conflicts or data corruption.
5. Data Analysis and Reporting:
DBMSs provide tools that enable data analysis and reporting. These tools allow
organizations to extract useful insights from their data, DBMSs provide features like data
visualization and reporting, which enable organizations to present their data in
understandable way.
6. Scalability and Flexibility:
DBMSs provide scalability and flexibility, enabling organizations to handle increasing
amounts of data. DBMSs can be scaled horizontally by adding more servers or vertically
by increasing the capacity of existing servers. This makes it easier for organizations to
handle large amounts of data without compromising performance. Moreover, DBMSs
provide flexibility in terms of data modeling, enabling organizations to adapt their
databases to changing business requirements.
7. Cost-Effectiveness:
DBMSs are cost-effective compared to traditional file-based systems. They reduce storage
costs by eliminating redundancy and optimizing data storage. They also reduce
development costs by providing tools for database design, maintenance, and
administration. Moreover, DBMSs reduce operational costs by automating routine tasks
and providing self-tuning capabilities.
Characteristics of DBMS
Simple Architecture: 1-Tier Architecture is the most simple architecture to set up, as only
a single machine is required to maintain it.
Cost-Effective: No additional hardware is required for implementing 1-Tier Architecture,
which makes it cost-effective.
Easy to Implement: 1-Tier Architecture can be easily deployed, and hence it is mostly
used in small projects.
2-Tier Architecture
The 2-tier architecture is similar to a basic client-server model. The application at the
client end directly communicates with the database on the server side.
APIs like ODBC(Open Database Connectivity) and JDBC(Java Database
Connectivity.) are used for this interaction. The server side is responsible for providing
query processing and transaction management functionalities.
On the client side, the user interfaces and application programs are run. The application on
the client side establishes a connection with the server side to communicate with the
DBMS.
An advantage of this type is that maintenance and understanding are easier, and compatible
with existing systems. However, this model gives poor performance when there are a large
number of users.
2 Tier Architecture examples are:-
File-Server Architecture: A client accesses a shared file server for data storage and
retrieval.
Client-Server Architecture: A client communicates directly with a database server for
data storage and retrieval.
Terminal Services Architecture: A client communicates directly with a terminal server,
which then communicates with a database server for data storage and retrieval.
Web-Based Architecture: A web browser communicates directly with a web server, which
communicates with a database server for data storage and retrieval.
Advantages of 2-Tier Architecture
Easy to Access: 2-Tier Architecture makes easy access to the database, which makes fast
retrieval.
Scalable: We can scale the database easily, by adding clients or upgrading hardware.
Low Cost: 2-Tier Architecture is cheaper than 3-Tier Architecture and
Multi-Tier Architecture.
Easy Deployment: 2-Tier Architecture is easier to deploy than 3-Tier Architecture.
Simple: 2-Tier Architecture is easily understandable as well as simple because of only two
components.
3-Tier Architecture
In 1971, DBTG(DataBase Task Group) realized the requirement for a two-level approach
having views and schema.
in 1975, ANSI-SPARC realized the need for a three-level approach with the three levels of
abstraction external level , a conceptual level, and an internal level.
The three schema architecture is also called ANSI/SPARC architecture or three-level
architecture.((American National Standards Institute, Standards Planning And
Requirements Committee)
This framework is used to describe the structure of a specific database system.
The three schema architecture is also used to separate the user applications and physical
database.
The three schema architecture contains three-levels. It breaks the database down into three
different categories.
Objectives of Three schema Architecture
The main objective of three level architecture is to enable multiple users to access the same
data with a personalized view while storing the underlying data only once. Thus it
separates the user's view from the physical structure of the database.
This separation is desirable for the following reasons:
Different users need different views of the same data.
The approach in which a particular user needs to see the data may change over time.
All users should be able to access the same data according to their requirements.
DBMS should be able to change the conceptual structure of the database without affecting
the user's
Internal structure of the database should be unaffected by changes to physical aspects of
the storage.
Presentation Tier: The presentation tier is the user interface or client layer of the
application. It is responsible for presenting data to the user and receiving input from the
user. This tier can be a web browser, mobile app, or desktop application.
Application Tier: The application tier is the middle layer of the 3-tier architecture. It is
responsible for processing and managing the business logic of the application. This tier
communicates with the presentation tier to receive user input and communicates with the
data management tier to retrieve or store data. This tier may include application servers,
web servers.
Data Management Tier: The data management tier is the bottom layer of the 3-tier
architecture. It is responsible for managing and storing data. This tier can include
databases, data warehouses, or data lakes. The data management tier communicates with
the application tier to receive or store data.
1. Internal Level
The internal level has an internal schema which describes the physical storage structure of
the database.
The internal schema is also known as a physical schema.
It uses the physical data model. It is used to define that how the data will be stored in a
block.
The physical level is used to describe complex low-level data structures in detail.
2. Conceptual Level
The conceptual schema describes the design of a database at the conceptual level. Conceptual
level is also known as logical level.
The conceptual schema describes the structure of the whole database.
The conceptual level describes what data are to be stored in the database and also describes
what relationship exists among those data.
In the conceptual level, internal details such as an implementation of the data structure are
hidden.
Programmers and database administrators work at this level.
3. External Level
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.
An external schema is also known as view schema.
Each view schema describes the database part that a particular user group is interested and
hides the remaining database from that user group.
The view schema describes the end user interaction with database systems.
Advantages of 3-Tier Architecture
A database schema is the skeleton structure that represents the logical view of the entire
database. It defines how the data is organized and how the relations among them are
associated.
A database schema is a logical representation of data that shows how the data in a
database should be stored logically. It shows how the data is organized and the relationship
between the tables.
Database schema contains table, field, views and relation between different keys like
primary key, foreign key.
Data are stored in the form of files which is unstructured in nature which makes accessing
the data difficult. Thus to resolve the issue the data are organized in structured way with
the help of database schema.
Database schema defines a set of guidelines that control the database along with that it
provides information about the way of accessing and modifying the data.
Types of Database Schemas
Physical Database Schema
A Physical schema defines, how the data or information is stored physically in the storage
systems in the form of files & indices. This is the actual code or syntax needed to create
the structure of a database, we can say that when we design a database at a physical level,
it’s called physical schema.
The Database administrator chooses where and how to store the data in the different blocks
of storage.
Logical Database Schema
A logical database schema defines all the logical constraints that need to be applied to the
stored data, and also describes tables, views, entity relationships, and integrity constraints.
The Logical schema describes how the data is stored in the form of tables & how the
attributes of a table are connected.
View Database Schema
It is a view level design which is able to define the interaction between end-user and
database.
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.
Creating Database Schema
For creating a schema, the statement “CREATE SCHEMA” is used in every database. But
different databases have different meanings for this.
1. MySQL: In MySQL, we use the “CREATE SCHEMA” statement for creating the
database, because, in MySQL CREATE SCHEMA and CREATE DATABASE, both
statements are similar.
2. SQL Server: In SQL Server, we use the “CREATE SCHEMA” statement for creating a
new schema.
3. Oracle Database: In Oracle Database, we use “CREATE USER” for creating a new
schema, because in the Oracle database, a schema is already created with each database
user. The statement “CREATE SCHEMA” does not create a schema, instead, it populates
the schema with tables & views and also allows one to access those objects without
needing multiple SQL statements for multiple transactions.
Database Schema Designs
Flat Model
A flat model schema is a 2-D array in which every column contains the same type of
data/information and the elements with rows are related to each other. It is just like a table
or a spreadsheet. This schema is better for small applications that do not contain complex
data.
Hierarchical Model
Data is arranged using parent-child relationships and a tree-like structure in the
Hierarchical Database Model. Because each record consists of several children and one
parent, it can be used to illustrate one-to-many relationships in diagrams such as
organizational charts. Although obvious, it might not be as adaptable in complicated
partnerships.
Network Model
he network model and the hierarchical model are quite similar with an important difference
that is related to data relationships. The network model allows many-to-many relationships
whereas hierarchical models allow one-to-many relationships.
Relational Model
The relational model is mainly used for relational databases, where the data is stored as
relations of the table. This relational model schema is better for object-oriented
programming.
Star Schema
Star schema is better for storing and analyzing large amounts of data. It has a fact table at
its center & multiple dimension tables connected to it just like a star, where the fact table
contains the numerical data that run business processes and the dimension table contains
data related to dimensions such as product, time, people, etc. or we can say, this table
contains the description of the fact table. The star schema allows us to structure the data of
Snowflake Schema
Just like star schema, the snowflake schema also has a fact table at its center and multiple
dimension tables connected to it, but the main difference in both models is that in
snowflake schema – dimension tables are further normalized into multiple related tables.
The snowflake schema is used for analyzing large amounts of data.
Database Instance
The data stored in database at a particular moment of time is called instance of database.
The situation where a data or information is stored in the database at a particular moment
of time is called an instance. An instance is also called a current state or database state.
The database schema that defines variables in tables which belong to a specific database,
the records of these variables at a particular moment are called the instance of the
database.
Consider a table given below which has the Student (Schema)
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 to change the schema at the
next level. it helps to keep the data separated from all program 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
Physical Level Data Independence
It refers to the characteristic of being able to modify the physical schema without any
alterations to the conceptual or logical schema, done for optimization purposes, e.g., the
Conceptual structure of the database would not be affected by any change in storage size of
the database system server. 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.
Logical Level Data Independence
It refers characteristic of being able to modify the logical schema without affecting the
external schema or application program. The user view of the data would not be affected
by any changes to the conceptual view of the data. These changes may include insertion or
deletion of attributes, altering table structures entities or relationships to the logical
schema, etc.
Centralized Database Management System
A centralized database is basically a type of database that is stored, located as well as maintained
at a single location only.
This type of database is modified and managed from that location itself. This location is thus
mainly any database system or a centralized computer system. The centralized location is
accessed via an internet connection (LAN, WAN, etc).
The centralized database is used by organizations such as colleges, industries, banks etc.
Advantages:
The data integrity is maximized as the whole database is stored at a single physical location. This
means that it is easier to coordinate the data and it is as accurate and consistent as possible.
The data redundancy is minimal in the centralized database. All the data is stored together and not
scattered across different locations. So, it is easier to make sure there is no redundant data
available.
Since all the data is in one place, there can be stronger security measures around it. So, the
centralized database is much more secure. Since all the data is in one place, there can be stronger
security measures around it. So, the centralized database is much more secure.
Data is easily portable because it is stored at the same place.
The centralized database is cheaper than other types of databases as it requires less power and
maintenance.
All the information in the centralized database can be easily accessed from the same location and
at the same time
Disadvantages:
Since all the data is at one location, it takes more time to search and access it. If the
network is slow, this process takes even more time
There is a lot of data access traffic for the centralized database. This may create a
bottleneck situation.
if multiple users try to access it simultaneously it creates a problem. This may
reduce the efficiency of the system.
If there are no database recovery measures in place and a system failure occurs, then all the
data in the database will be destroyed.
Transaction server
Also called query server systems or SQL server systems.
Usually, client machines ship transactions to the server systems, where those transactions
are executed, and results are shipped back to clients that are in charge of displaying the
data.
Requests may be specified by using SQL.
Clients send requests to the server.
Transactions are executed at the server.
Results are shipped back to the client.
Transaction Server Architecture
Server processes
These receive user transactions, execute them and send results back
Processes may be multithreaded, allowing a single process to execute several user queries concurrently.
Typically multiple multithreaded server processes.
Lock manager process
Manages lock manager functionality.
It includes lock grant, lock release and deadlock detection.
Database writer process
Output modified buffer blocks to disks continually.
Log writer process
Server processes simply add log records to log record buffer.
Log writer process outputs log records to stable storage.
Checkpoint process
Performs periodic checkpoints.
Process monitor process
Monitors other processes, and takes recovery actions if any of the other processes fail.
E.g., aborting any transactions being executed by a server process and restarting it.
Shared memory contains shared data
1)Buffer pool
2)Lock table
3)Log buffer
4)Cached query plans
A typical transaction server consists of multiple processes accessing data in shared
memory.
All database processes can access shared memory.
To ensure that no two processes are accessing the same data structure at the same time,
databases systems implement mutual exclusion using either
1)Operating system semaphores
2)Atomic instructions such as test-and-set