Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 82

1.

Introduction DBMS – Concepts &Architectures(10)

 1.1 Database and Need for DBMS, Characteristics of DBMS


 1.2 Database 3-tier schema (ANSI/SPARC) and system architecture of DBMS
 1.3 Views of data- Schemas and instances, Data Independence
 1.4 Centralized, Client-Server system, Transaction, servers, Data servers, Cloud based
servers
HISTORY OF DATABASE SYSTEM
 In early 1960s, the first general purpose DBMS was designed by Charles Bachman at
General Electric, which was later, called as IDS (Integrated Data Store).
 This IDS formed a groundwork for introduction of Network Data Model, which was later,
standardized by CODASYL (Conference on Data Systems Languages).
 In late 1960s, IBM developed the IMS (Information Management System) which was
widely used.
 This IMS formed groundwork for introduction of Hiearchical Data Model
 By the joint venture of IBM and American Airlines, the SABRE system was launched
which help the people to reserve the tickets.
 The new data representation framework was initially launched by Edgar Codd, called the
Relational data model.
 Both Bachman and Edgar Codd were felicitated by ACM Turing Award in the year 1973
and 1981 for the outstanding contribution in the field of database system.
 With the time passed by, the DBMS system has matured significantly. As the development
of relational DBMS has reached to larger users and the number of benefits from the same,
it was widely accepted and many corporate houses started using this system for their day to
day activities.
File system has several disadvantages and the following problems are associated with file
system:
1. Data redundancy and inconsistency
 The major problem with file processing system is that it maintains several versions of same
file i.e.; duplication of data is possible at multiple places
 Also there are several copies of files are stored, if any one of the file is changed, the different
versions of same file may not be updated which leads to inconsistency of data.
2. Difficulty in accessing the data
 Consider the airline reservation system. If the senior management of company wants to access
the information of all its customers who are living in the same postal code, it has to be done
manually because current file processing system does not allow the user to obtain this
information.
 So in the above case, there are two options. Either the application programmer has to write a
new application program to satisfy the unusual request or could get this information manually.
 In former case, it doesn’t guarantee that the same query will be asked and same application
program would be used in future.
 If a query changes, a new application program should be written to get the needed information.
3. Data isolation
 One of the major problems with the file system is that the data is scattered and stored in
multiple locations and in different formats.
 Hence in order to retrieve the needed information from multiple location and in different
formats is a very difficult to proceed with the help of application program.
4. Concurrent access anomalies
 In order to speed up the performance of the system and faster response to applications,
many systems allow the user to update the data concurrently.
 Suppose two users located at different locations wants to book the tickets, there might be
situation that both of the people will be given the same seat because the data is stored in
multiple locations and both of them will be given a seat from individual copy of the data
 Therefore there should be some protection mechanism to avoid this concurrent updates
5. Security problems
 Every user in this system should be able to access the data which he is allowed to access
and not all the data.
 For example, the salesperson in an organization should be allowed to access the data
related to him and should not be allowed to access data which is used HR team or finance
department in an organization.
 If the new constraints are added to avoid this kind of unauthorized access, these
constraints is difficult because the existing application programs are added to the system in
an adhoc manner.
6. Integrity problems
 Data stored in the database should be allowed to satisfy certain constraint checking.
 For eg, before adding a new employee in the Employee table, if we check the age of the
employee and if we apply constraint such that only those employee whose age is greater
than 18 years should be allowed to enter in the table which means that before the new data
is inserted the age of the employee should be calculated.
 When a new constraint such as one which is discussed above is added, it becomes difficult
to change the existing programs to enforce the new constraints.
7. Atomicity problems
 Every application system is assumed to fail at some point in near future.
 In many applications, if the system fails, the data should be rolled back to the state before
the failure occurs.
 Consider the customer is withdrawing some cash from the ATM machine from his own
account and if the failure happens in the system, it should not happen that the amount is
deducted from customer account but the customer is not getting any cash from the machine
 In simple word the withdrawn should be atomic- it must be happen in its entirely or not at
all.
 Another disadvantage with file processing system is that it becomes difficult to ensure
atomicity.
Difference between File System and DBMS
File System DBMS
 The file system is a way of arranging the
 DBMS is software for managing the
files in a storage medium within a
computer. database

  In DBMS there is no redundant data.


Redundant data can be present in
  It provides in house tools for backup and
It doesn’t provide Inbuilt mechanism for
backup and recovery of data if it is lost. a recovery of data even if it is lost.
file system.  Efficient query processing is there in
 There is no efficient query processing in DBMS.
the file system.
 There is less data consistency in the file  There is more data consistency because
system. of the process of normalization.
 It is less complex as compared to  It has more complexity in handling as
DBMS. compared to the file system.
 File systems provide less security in  DBMS has more security mechanisms as
comparison to DBMS. compared to file systems.
 It is less expensive than DBMS.  It has a comparatively higher cost than
 Only one user can access data at a time. file system
 Data is distributed in many files. So, it is  Multiple users can access data at a time.
not easy to share data
Concept:
 Definition
 A Database Management System (DBMS) is a software system that is designed to manage
and organize data in a structured manner. It allows users to create, modify, and query a
database, as well as manage the security and access controls for that database.
 It also includes features such as data validation, indexing, and data security
 Database Management System (DBMS) is an assortment of programs and applications that
are used to manage the database.
 DBMS has a various set of the user who extracts and manipulate the data for a range of
business and personal requirements.
 It might be used by an administrator who basically ensures that the data stored in the
system is secured and limits the free access to other users.
Some examples of Database Management System

 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

1)Data Definition Language


 DDL is the short name for Data Definition Language, which deals with database schemas and
descriptions, of how the data should reside in the database.
 CREATE: to create a database and its objects like (table, index, views, store procedure, function,
and triggers)
 ALTER: alters the structure of the existing database
 DROP: delete objects from the database
 TRUNCATE: remove all records from a table, including all spaces allocated for the records are
removed(TRUNCATE is a SQL command that removes all the rows from a table without using
any condition. )
 COMMENT: add comments to the data dictionary
2)Data Manipulation Language
 DML is the short name for Data Manipulation Language which deals with data
manipulation and includes most common SQL statements such SELECT, INSERT,
UPDATE, DELETE, etc., and it is used to store, modify, retrieve, delete and update data in
a database.
 SELECT: retrieve data from a database
 INSERT: insert data into a table
 UPDATE: updates existing data within a table
 DELETE: Delete all records from a database table
 MERGE: INSERT operation (insert or update)
 LOCK TABLE: concurrency Control
3)Data Control Language
 DCL is short for Data Control Language which acts as an access specifier to the database.
(basically to grant and revoke permissions to users in the database
 GRANT: grant permissions to the user for running DML(SELECT, INSERT, DELETE,…)
commands on the table
 REVOKE: revoke permissions to the user for running DML(SELECT, INSERT, DELETE,
…) command on the specified table
4)Transactional Control Language
 TCL is short for Transactional Control Language which acts as an manager for all types of
transactional data and all transactions. Some of the command of TCL are
 Roll Back: Used to cancel or Undo changes made in the database
 Commit: It is used to apply or save changes in the database
 Save Point: It is used to save the data on the temporary basis in the database
Advantages of DBMS
 Better Data Transferring: Database management creates a place where users have an
advantage of more and better-managed data. Thus making it possible for end-users to have
a quick look and to respond fast to any changes made in their environment.
 Better Data Security: The more accessible and usable the database, the more it is prone to
security issues.
 As the number of users increases, the data transferring or data sharing rate also increases
thus increasing the risk of data security. It is widely used in the corporate world where
companies invest large amounts of money, time, and effort to ensure data is secure and
used properly. A Database Management System (DBMS) provides a better platform for
data privacy and security policies thus, helping companies to improve Data Security.
 Better data integration: Due to the Database Management System we have access to
well-managed and synchronized forms of data thus it makes data handling very easy and
gives an integrated view of how a particular organization is working and also helps to keep
track of how one segment of the company affects another segment.
 Minimized Data Inconsistency: Data inconsistency occurs between files when different
versions of the same data appear in different places.
 Better decision making: Due to DBMS now we have Better managed data and Improved
data access because of which we can generate better quality information hence on this
basis better decisions can be made. Better Data quality improves accuracy, validity, and
the a time it takes to read data.
 Increased end-user productivity: The data which is available with the help of a
combination of tools that transform data into useful information, helps end-users to make
quick, informative, and better decisions that can make a difference between success and
failure in the global economy.
 Simple: Database management system (DBMS) gives a simple and clear logical view of
data. Many operations like insertion, deletion, or creation of files or data are easy to
implement.
 Data abstraction: The major purpose of a database system is to provide users with an
abstract view of the data. Since many complex algorithms are used by the developers to
increase the efficiency of databases that are being hidden by the users through various data
abstraction levels to allow users to easily interact with the system.
 Reduction in data Redundancy: When working with a structured database, DBMS
provides the feature to prevent the input of duplicate items in the database. for e.g. – If
there are two same students in different rows, then one of the duplicate data will be
deleted.
 Application development: A DBMS provides a foundation for developing applications
that require access to large amounts of data, reducing development time and costs.
 Data sharing: A DBMS provides a platform for sharing data across multiple applications
and users, which can increase productivity and collaboration.
 Data organization: A DBMS provides a systematic approach to organizing data in a
structured way, which makes it easier to retrieve and manage data efficiently.
 The atomicity of data can be maintained: That means, if some operation is
performed on one particular table of the database, then the change must be reflected for
the entire database.
 Scalability and flexibility: DBMS is highly scalable and can easily accommodate changes
in data volumes and user requirements. DBMS can easily handle large volumes of data,
and can scale up or down depending on the needs of the organization. It provides
flexibility in data storage, retrieval, and manipulation, allowing users to easily modify the
structure and content of the database as needed.
 Improved productivity: DBMS reduces the time and effort required to manage data,
which increases productivity and efficiency. It also provides a user-friendly interface for
data entry and retrieval, which reduces the learning curve for new users.
Disadvantages of DBMS

 Complexity: DBMS can be complex to set up and maintain, requiring specialized


knowledge and skills.
 Performance overhead: The use of a DBMS can add overhead to the performance of an
application, especially in cases where high levels of concurrency are required.
 Scalability: The use of a DBMS can limit the scalability of an application, since it
requires the use of locking and other synchronization mechanisms to ensure data
consistency.
 Cost: The cost of purchasing, maintaining and upgrading a DBMS can be high, especially
for large or complex systems.
 Limited Use Cases: Not all use cases are suitable for a DBMS, some solutions don’t need
high reliability, consistency or security and may be better served by other types of data
storage.
Applications of DBMS in different sectors
 Manufacturing: Product-based industries manufactures different types of products and
deliver them on a daily, weekly, or monthly basis. In this sector, DBMS is used to store
information about products like the quantity of the products, product bills, supply chain
management, etc.
 Banking & Finance: In banking, DBMS is used to store the customer transaction details
and in the finance sector it is used to hold the data about sales, stocks, and bonds.
 Education sector: DBMS is very useful for this sector. Information about the students,
their attendance, courses, fees, results, is stored in the database. Apart from this DBMS is
used to store the staff data also.
 Credit card transaction: While purchasing a credit card and creating a monthly statement
DBMS is used.
 Social media sites: Now a days social media are the popular platforms to share our
thoughts and views with the world and with our friends. Social media also allow us to
connect with our friends. Millions of sign-ins and sign-ups happen daily for social media
like Facebook, Twitter, Linkedin, and so on. All these things happen with the help of
DBMS that allows us to connect with others.

 Telecommunication: All telecommunication companies use DBMS. The database


management system is crucial for this sector to store monthly postpaid bills and call details
of the customer in the database.
 Railways & airlines reservation system: DBMS is necessary to store the data of ticket
booking and also used to store the information of train/ airplane arrivals, and delay status.
 Human resource management: Big industries have more employees. DBMS is required
to store employee’s information like their permanent address, salary, tax, etc.

 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

 1. Real World Entity


 The reality of DBMS (Database Management System) is one of the most important and
easily understandable characteristics. The DBMS (Database Management System) is
developed in such a way that it can manage huge business organizations and store their
business data with security.
 The Database can store information such as the cost of vegetables, milk, bread, etc. In
DBMS (Database Management System), the entities look like real-world entities.
 2. Self-explaining nature
 In DBMS (Database Management System), the Database contains another database, and
another database also contains metadata.
 Here the term metadata means data about data.
 For example, in a school database, the total number of rows and the table's name are
examples of metadata.
 So the self-explaining nature means the Database explains all the information
automatically itself. This is because, in the Database, all the data are stored in a structured
format.
 3. Atomicity of Operations (Transactions)
 Here, atomicity means either the operation should be performed or not performed. i.e., it
should complete the operation on 0% or 100%.
 Here DBMS (Database Management System) provides atomicity as a characteristic. This is
the most important and useful characteristic of the DBMS (Database Management
System).
 4. Concurrent Access without Anomalies
 Here the term anomalies mean multiuser can access the Database and fetch the information
without any problem.
 For a better understanding, let's take the example of a bank again. Let Sonu give his ATM
card to his sister Archita and tell her to withdraw 5000 from the ATM. At the same time,
Sonu transferred 2000 rupees to his brother Monu. At the same time, both operations
perform successfully. Initially, Sonu had 10000 rupees in his bank account. After both
transactions, i.e., transfer and withdraw, when Sonu checks his bank balance, it shows
3000 rupees. This error-free updation of bank balance is possible with the help of the
concurrent feature of the Database.
 Thus here we see that concurrent is a great feature of the Database.
 5. Stores Any Kind of Structured Data
 The Database has the ability to store the data in a structured format.
 In most of the websites, we see that only student database examples are given for a better
understanding, but the important fact is that the Database has the ability to store an
unlimited amount of data.
 DBMS has the ability to store any type of data that exists in the real world, and these data
are structured way. It is another type of very important characteristic of DBMS.
 6. Integrity
 Here the term integrity means the data should be correct and consistent in nature. Let's
understand this by taking an example.
 Let's say there is a bank named ABC bank, and ABC bank has its own Database for the
storage of its customer data. If we try to enter the account details of ABC bank and the
account details are not available in the bank, then the Database gives the incorrect output.
However, if a customer changes their address but the new address is not updated in the
Database, it is called data inconsistency.
 So the data available in the Database should be correct as well as consistent.
 7. SQL and No-SQL Databases
 There are two types of databases (not DBMS): SQL and No-SQL.
 The SQL databases store the data in the form of Tables, i.e., rows and columns. The No-
SQL databases can store data in any form other than a table.
 The availability of SQL and No-SQL databases allows us to choose the method of storing
the data as well.
 There should not be any debate between SQL and No-SQL databases. The one that we
require for a particular project is better for that project, while the other might be better for
some other use.
 This is a characteristic of DBMS because DBMS allows us to perform operations on both
kinds of databases. So, we can run queries and operations on SQL as well as No-SQL
databases.
 8. ACID Properties
 The DBMS follows certain properties to maintain consistency in the Database. These
properties are usually termed ACID Properties.
 ACID stands for Atomicity, Consistency, Isolation, and Durability.
 Atomicity means the transaction should either be 0% or 100% completed, and consistency
means that the change in data should be reflected everywhere in a database.
 Isolation means that multiple transactions can occur independently without the interference
of some other transactions.
 Durability means that the chances of a successful atomic transaction, i.e., a transaction that
has been 100% completed, should reflect in the Database.
 9. Security
 The Database should be accessible to the users in a limited way.
 The access to make changes to a database by the user should be limited, and the users must
not be given complete access to the entire Database.
 Unauthorized users should not be allowed to access the Database.
DBMS Architecture
 A Database stores a lot of critical information to access data quickly and securely.
 Hence it is important to select the correct architecture for efficient data management.
 DBMS Architecture helps users to get their requests done while connecting to the
database.
 We choose database architecture depending on several factors like the size of the database,
number of users, and relationships between the users.
 There are two types of database models that we generally use, logical model and physical
model. Several types of architecture are there in the database which we will deal with in
the next section.
1-Tier Architecture
 In 1-Tier Architecture the database is directly available to the user, the user can directly sit
on the DBMS and use it that is, the client, server, and Database are all present on the same
machine.
 For Example: to learn SQL we set up an SQL server and the database on the local system.
This enables us to directly interact with the relational database and execute operations. The
industry won’t use this architecture they logically go for 2-tier and 3-tier Architecture.
Advantages of 1-Tier Architecture

 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

 Enhanced scalability: Scalability is enhanced due to the distributed deployment of


application servers. Now, individual connections need not be made between the client and
server.
 Data Integrity: 3-Tier Architecture maintains Data Integrity. Since there is a middle layer
between the client and the server, data corruption can be avoided/removed.
 Security: 3-Tier Architecture Improves Security. This type of model prevents direct
interaction of the client with the server thereby reducing access to unauthorized data.
Disadvantages of 3-Tier Architecture

 More Complex: 3-Tier Architecture is more complex in comparison to 2-Tier


Architecture. Communication Points are also doubled in 3-Tier Architecture.
 Difficult to Interact: It becomes difficult for this sort of interaction to take place due to
the presence of middle layers.
Views of data- Schemas and instances
 What is Schema?
 The Skeleton of the database is created by the attributes and this skeleton is named
Schema.
 Schema mentions the logical constraints like table, primary key, etc.
 The schema does not represent the data type of the attributes.
Database Schema

 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)

Std ID Name City

100 Lucky Hyderabad

101 Pinky Delhi

102 Bob Hyderabad

 In the above table, rows are called instances.


 Finally, we can say that the content of database at a point of time is called instance or
database state
Difference Between Schema and Instance
Schema Instance
 It is the overall description of the  It is the collection of information stored
database. in a database at a particular moment.
 The schema is same for the whole  Data in instances can be changed using
database addition, deletion, and updating.
 Does not change Frequently.  Changes Frequently.
 Defines the basic structure of the  It is the set of Information stored at a
database i.e. how the data will be stored particular time.
in the database.
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 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

You might also like