0% found this document useful (0 votes)
24 views165 pages

WINSEM2023-24 BCSE302L TH CH2023240502444 Reference Material I 08-01-2024 MODULE 1

The document provides an overview of the BCSE302L Database Systems course. It outlines the course objectives which include understanding database concepts, designing ER models, normalizing schemas, and transaction management. It also describes database system terminology, components, and advantages compared to file systems. The document introduces various data models, schemas, and the three schema architecture. It discusses the roles of different actors who work with databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views165 pages

WINSEM2023-24 BCSE302L TH CH2023240502444 Reference Material I 08-01-2024 MODULE 1

The document provides an overview of the BCSE302L Database Systems course. It outlines the course objectives which include understanding database concepts, designing ER models, normalizing schemas, and transaction management. It also describes database system terminology, components, and advantages compared to file systems. The document introduces various data models, schemas, and the three schema architecture. It discusses the roles of different actors who work with databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 165

BCSE302L-DATABASE

SYSTEMS
By
G.Sukanya (Asst. Prof)
SCOPE
Course Objectives
• To understand the concepts of File system and structure of
the database; Designing an Entity-Relationship model for a
real-life application and Mapping a database schema from
the ER model.
• To differentiate various normal forms, evaluate relational
schemas for design qualities and optimize a query.
• To impart the working methodologies of transaction
management, understand concurrency control, recovery,
indexing, access methods and fundamental view on
unstructured data and its management
MODULE 1
Database Systems
Concepts and Architecture
Outline
• Introduction to Database systems-Terminolgies
• Need for Database systems
• Characteristics of DB approach
• Actors on the scene
• Workers behind the scene(DBA)
• Advantages of using DBMS approach
Introduction to Database systems
Terminologies
• Data
• Information
• Database
• DBMS
Data
• Raw facts that are unorganized and can be
recorded-texts, numbers, videos, speech,images
etc.,
• Real Time Examples of DBMS:Flipkart,Ola,uber
• More data=More wealth
• Recommendation of items in amazon shopping
website
What is a database?
• Collection of related data (to solve some
problems/queries)
• Represents real world entities/objects
• Addition/deletion of record should be reflected
in a database
Information
• Meaningful/Processed data from the whole lot
Data or Database?
• Newspaper
• University website
Criterion for a database
• Database should represent real world or so called mini
world so that changes in the real world should be
reflected in the database.
• Database should be a collection of logical and coherent
data and not some random data
• Db should be created with 3 things in mind
–A specific purpose
–An intended group of usera
–A preconceived application that theses intended users
have in mind.
Example 1
Example 2
DBMS
• It’s a collection of programs that enables users to
create and maintain a database.
Drawbacks of File system
Drawbacks of File System cont..
– Atomicity of updates
• Failures may leave database in an inconsistent state with
partial updates carried out
• E.g. transfer of funds from one account to another should
either complete or not happen at all
– Concurrent access by multiple users
• Concurrent accessed needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
– E.g. two people reading a balance and updating it at the same time
– Security problems
Limitations of File Management System
with Example
• Customer name with Phone numbers
• For 10 persons its easy to enter,search,update etc,but
for 1000 persons or more?
• File Access problem-Client Server Architecture-Solved
using DBMS
• Redundancy Problem -Eg: Many different views of
same file. Leads to storage problem
• Inconsistency: If redundancy persists,a particular
record may not be updated properly in all those files
Why it is better to use DBMS
• User interacts directly with DB

• If DBMS is used, User interacts with DBMS, and DBMS with DB


Database Management Systems
• Manages the DB using software tools/programs
• Responsible for definition of the data, construction
for the database, manipulation of DB
• DBMS varies for each type of data
• DB+DBMS=DBS
• DBMS-used for large amount of data
A database management system (or DBMS) is a computerized
data-keeping system.
Users of the system are given facilities to perform several kinds
of operations on such a system for either manipulation of the
data in the database or the management of the database structure
itself.
DBMS revisited..
A database management system (DBMS) is a collection
of programs enabling users to create and maintain a
database.It is a general purpose software system
facilitating each of the following (with respect to a
database):
• definition: specifying data types (and other constraints
to which the data must conform) and data organization
• construction: the process of storing the data on some
medium (e.g., magnetic disk) that is controlled by the
DBMS
• manipulation: querying, updating, report generation
• sharing: allowing multiple users and programs to
access the database "simultaneously"
• system protection: preventing database from
becoming corrupted when hardware or software
failures occur
• security protection: preventing unauthorized or
malicious access to database.
A database together with the DBMS software is
referred to as a database system.
Need/Purpose of DBMS
• Storage of data –Non redundancy
• Retrieval of data
Popular DBMS
• PostgreSQL
• Oracle Database
• Microsoft SQL Server
• MySQL
• SQLite
• IBM Db2
Applications
• Database Applications:
– Banking: all transactions
– Airlines: reservations, schedules
– Universities: registration, grades
– Sales: customers, products, purchases
– Manufacturing: production, inventory, orders, supply
chain
– Human resources: employee records, salaries, tax
deductions
Characteristics of Database approach
• Self describing nature of a database system
• Insulation between Programs and Data, and Data
Abstraction
• Support of Multiple Views of the Data
• Sharing of Knowledge and Multi-user Transaction
Processing
• Security
• Query Language-CRUD
Self describing Nature
Insulation between Program and Data
Support of Multiple Views
Sharing of Data & multiuser transaction
Actors on the scene
People whose jobs involve the day-to-day use of a
large database.
• Database Administrators.
• Database Designers.
• End Users.
• System Analysts and Application Programmers
(Software).
Canned Transactions
• Canned Transactions--They are the standard type of
queries and updates to query the database for some
data or to update the data for some changes,
• Like for eg,reservation agent for airlines or hotel or
train or bus as per the request from the customer they
check the availability and make reservations on a daily
basis
• They make similar set of functions to make
reservations or to check for availability and so they
have predefined set of queries to query that they want
or for updating the db for changes
Workers behind the Screen
One who work to maintain the database system
environment but who are not actively interested in
the database contents as part of their daily job.
• Operators and Maintenance Personnel/System
Administration Personnel
Advantages of DBMS approach
• Better Data Transferring
• Better Data Security
• Better data integration
• Minimized Data Inconsistency
• Faster data Access
• Better decision making
• Increased end-user productivity
• Simple
• Data abstraction
• Reduction in data Redundancy
Data Models, Schemas, Instances
Three Level Schema
Outline
• Data Models and their categories
• History of Data Models
• Schemas,Instances and states
• Three Schema architecture
• Data Independence
• Data Modeling is the process of organizing real-world data
under the scope of a business requirement in a structured
manner.
• The conceptual model is the least detailed; it is the very first
model and the most abstract part of our data modeling
process. We use this high-level model to start defining our
concept and to communicate with non-technical user groups
and business owners.
• The logical model adds more technical detail (like data types)
• The physical model adds database-specific information.
Data Models
• A data model—a collection of concepts that can be
used to describe the structure of a database—provides
the necessary means to achieve this abstraction.
• By structure of a database we mean the data types,
relationships, and constraints that apply to the data.
Most data models also include a set of basic operations
for specifying retrievals and updates on the database
Data Models
Categories of data model
1.Relational Model
Example-Relational Model
2.Entity-Relationship Model
Example-Entity-Relationship Model
3.Object -Based Model
Example-Object -Based Model
4.Semi structured Model
Example-Semi structured Model

<Note>
<From> Academia</From>
<To>All Students</To>
<Subject>Thank You</Subject>
<Body>GoodLuck</Body>
</Note>
User defined tags….
Other Data Models
History of data Models
• Hierarchical System was the first generation of DBMS.
The first generation also came with the CODASYL
system. Both of them introduced in 1960s.
• The second generation includes the Relational Model.
Dr. E.F.Codd introduced it in 1970.
• The third generation includes Object-Relational DBMS
and Object-Oriented DBMS.
• File based systems
File based systems came in 1960s and was widely used. It stores
information and organize it into storage devices like a hard disk, a
CD-ROM, USB, SSD, floppy disk, etc.
• Relational Model
Relational Model introduced by E.F.Codd in 1969. The model stated
that data will be represented in tuples.
• Dbase
Database like Dbase went on sale in 1980s. It was one of the first
database management systems for microcomputers. Cecil Wayne
Ratliff developed it.
• Centralized DBMS and Data Warehousing
In 1990s, centralized DBMS server was used. The period also
witnessed the introduction of MS-Access.
• NoSQL
NoSQL, Big Data came in 2008.
• Hadoop
Hadoop and MongoDB launched in 2009. Hadoop use
distributed file system for storing big data, and MapReduce to
process it. Hadoop excels in storing and processing of huge data
of various formats such as arbitrary, semi-, unstructured, etc
• Hbase
It introduced in 2010 and is a database built on top of the
HDFS. HBase provides fast lookups for larger tables.
Schema Versus Instances
Example of a Database schema
Database Instance
Database Schema Versus Database state
Example of a Database State
Three Schema Architecture
• Not explicitly used in commercial DBMS products,but
used in explaining database system organization
• Proposed to support DBMS characteristics of
– Program data independence
– Support of multiple views of the data
Three schema architecture
Three Schema Architecture
Three Schema Architecture
Data Independence

Example: Changing the bricks into wood for constructing a house withuot changing the
DBMS Languages
DBMS Languages
DML
Types of DML
DBMS Classification Systems
DBMS
DBMS is a collection of programs used for
managing data and simultaneously it supports
different types of users to
Create
Manage
Retrieve
Update
Store information
DBMS Classification Criteria
• Based on Data Model
• Relational Model
• Hierarchical Model
• Object Oriented Database Model
• Network Model
• Based on user numbers
• Single User
• Multi User
• Based on Database distribution
• Centralized Database
• Distributed Database
• Based on Purpose/usage
• General purpose
• Specific purpose
Based on data Model
Relational Model

• Data is organized in two-dimensional tables using


rows and columns.
• Most popular data models which is used in
industries. It is based on SQL.
• Every table in a database has a key field which
uniquely identifies each record.
• Available for personal computers, workstation
and large mainframe systems.
• Example − Oracle Database, MySQL, Microsoft
SQL Server etc.
EXAMPLE

STD_ID NAME CITY


201 Bob Hyderabad
204 Pinky Chennai
205 Pinky Bangalore

In the above student table Std ID, Name and city are
called as attributes and their values.
Std ID is a primary key attribute which uniquely
identifies each record in the student table.
Hierarchical Model
• Data elements have a one to many relationship
(1: N). Here data is organized like a tree which is
similar to a folder structure in your computer
system.
• The hierarchy starts from the root node,
connecting all the child nodes to the parent node.
• Used in industry on mainframe platforms.
• For example− IMS(IBM), Windows registry
(Microsoft).
EXAMPLE
Object Oriented Database Model
• System where information or data is represented in the
form of objects which is used in object-oriented
programming.
• Combination of relational database concepts and
object-oriented principles.
• Relational database concepts are concurrency control,
transactions, etc.
• OOPs principles are data encapsulation, inheritance,
and polymorphism.
• It requires less code and is easy to maintain.
• For example − Object DB software.
Network database Model
• Data elements maintain one to one
relationship (1: 1) or many to many
relationship (N: N).
• It also has a hierarchical structure, but the
data is organized like a graph and it is allowed
to have more than one parent for one child
record.
EXAMPLE

Eg: Teachers can teach in multiple departments.


Based on Number of User
Single user Database Systems
Multi-User Database System
• Access can be shared by multiple users at a
time
• Complexity increases with shared access and
structure of the database
• Switching between projects is easy as single
schema repository is used.
• Optimization of resources
Based on Database distribution
Centralized Database Systems
• The DBMS and database are stored at a single
site that is used by several other systems too.
Parallel Network Database Systems
• This system has the advantage of improving
processing input and output speeds.
• Majorly used in the applications that have
query to larger database. It holds the multiple
central processing units and data storage disks
in parallel.
Distributed Database
• The actual database and the DBMS software
are distributed from various sites that are
connected by a computer network.
(i)Homogenous DBMS
• They use same software but from the multiple
sites.
• Data exchange between the sites can be
handled easily.
• For example, library information systems by
the same vendor ,such as Geac Computer
corporation, use the same DBMS software
that allows the exchanges between various
Geac library sites.
(ii)Heterogenous DBMS
• Use different DBMS software for different
sites but there is a additional software that
helps the exchange of the data between the
sites.
Client-server database system
• Has two logical components namely client
and server. Clients are generally the personal
computers or workstations whereas servers
are the large workstations.
• The applications and tools of the DBMS run on
the client platforms and the DBMS software
on the server.
Multi-tier client-server database
system
• The rise of personal computers in business has
increased the reliability of the network
hardware leading to evolution of two-tier and
three-tier systems which use different
software for the client and software.
General Purpose DBMS
• Database which provides data for general
purpose application
• Eg Oracle
Specific purpose DBMS
• DBMS which is designed for specific purpose
such as railways and banks
• Eg:
• OLTP database
• OLAP database
• Multimedia DBMS
• Mobile DBMS
• Sensor DBMS etc.,
Session 3
Outline
• Database Languages in DBMS
• Database Language & Interfaces
• The Database System Environment
Database Languages in DBMS
• A DBMS has appropriate languages and interfaces to
express database queries and updates.
• Database languages can be used to read, store and
update the data in the database.
Types of DBMS Languages
DDL
• DDL stands for Data Definition Language. It is used to
define database structure or pattern.
• It is used to create schema, tables, indexes, constraints,
etc. in the database.
• Using the DDL statements, you can create the skeleton of
the database.
• 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.
DDL-Tasks/Commands
• Create: It is used to create objects in the database.
• Alter: It is used to alter the structure of the database.
• Drop: It is used to delete objects from the database.
• Truncate: It is used to remove all records from a table.
• Rename: It is used to rename an object.
• Comment: It is used to comment on the data
dictionary.
DML
used for accessing and manipulating data in a database. It
handles user requests.
• Select: It is used to retrieve data from a database.
• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
• Merge: It performs UPSERT operation, i.e., insert or update
operations.
• Call: It is used to call a structured query language or a Java
subprogram.
• Explain Plan: It has the parameter of explaining data.
• Lock Table: It controls concurrency.
Data Control Language (DCL)
• used to retrieve the stored or saved data.
• The DCL execution is transactional. It also has rollback
parameters.
• (But in Oracle database, the execution of data control
language does not have the feature of rolling back.)
DCL-Tasks
• Grant: It is used to give user access privileges to a
database.
• Revoke: It is used to take back permissions from the
user.
• There are the following operations which have the
authorization of Revoke:
CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and
SELECT.
Transaction Control Language (TCL)
• TCL is used to run the changes made by the DML
statement. TCL can be grouped into a logical
transaction.
TCL-TASKS
• Commit: It is used to save the transaction on the
database.
• Rollback: It is used to restore the database to original
since the last Commit.
ACID Properties
• Data should remain integrated when any changes are
done in it, because if the integrity of the data is
affected, whole data will get disturbed and corrupted.
• To maintain the integrity of the data, there are four
properties described in the database management
system, known as the ACID properties.
• The ACID properties are meant for the transaction that
goes through a different group of tasks.
ACID Properties in DBMS
1.Atomicity
• Data remains atomic.
• If any operation is performed on the data, either it
should be performed or executed completely or
should not be executed at all.
• Operation should not break in between or execute
partially.
Example
2.Consistency
• The word consistency means that the value
should remain preserved always.
• In the case of transactions, the integrity of the
data is very essential so that the database
remains consistent before and after the
transaction. The data should always be correct.
Example
3.Isolation
• The term 'isolation' means separation.
• Isolation is the property of a database where no data
should affect the other one and may occur
concurrently.
• In short, the operation on one database should begin
when the operation on the first database gets
complete.
• It means if two operations are being performed on two
different databases, they may not affect the value of
one another.
When two or more transactions occur simultaneously, the
consistency should remain maintained.
Any changes that occur in any particular transaction will not be
seen by other transactions until the change is not committed in the
memory.
4.Durability
• Durability ensures the permanency of something.
• In DBMS, the term durability ensures that the data
after the successful execution of the operation
becomes permanent in the database.
• The durability of the data should be so perfect that
even if the system fails or leads to a crash, the database
still survives.
• If gets lost, it becomes the responsibility of the
recovery manager for ensuring the durability of the
database. For committing the values, the COMMIT
command must be used every time we make changes.
Interfaces
Communication boundary between the DBMS and clients
Ability to input queries to a database without using the
query language itself.

• Form Based Interfaces


• Menu-Based Interfaces for Web Clients or Browsing
• Graphical User Interface
• Natural language Interfaces
• Interfaces for DBA
1.Form Based Interfaces
• A forms-based interface displays a form to each user.
Users can fill out all of the form entries to insert new
data or they can fill out only certain entries, in which
case the DBMS will redeem same type of data for other
remaining entries.
• Example: SQL* Forms is a form-based language that
specifies queries using a form designed in conjunction
with the relational database schema.
2.Menu Based Interfaces
• Presents the user with lists of options (called menus)
that lead the user through the formation of a request.
• Basic advantage of using menus is that they removes
the tension of remembering specific commands and
syntax of any query language.
• Example: Pull-down menus are a very popular
technique in Web based interfaces. They are also often
used in browsing interface
3.GUI
• Displays a schema to the user in diagrammatic form.
• The user then can specify a query by manipulating the
diagram.
• GUIs utilize both menus and forms. Most GUIs use a
pointing device such as mouse, to pick a certain part of
the displayed schema diagram.
4.Natural language Interfaces
• These interfaces accept request written in English or
some other language and attempt to understand them.
• A Natural language interface has its own schema, which
is similar to the database conceptual schema as well as
a dictionary of important words.
• The natural language interface refers to the words in its
schema as well as to the set of standard words in a
dictionary to interpret the request.
5.Interfaces for DBA
• Most database system contains privileged commands
that can be used only by the DBA’s staff.
• These include commands for creating accounts, setting
system parameters, granting account authorization,
changing a schema, reorganizing the storage structures
of a databases.
The Database System Environment (simplified)
• A database environment is a collective system of components that
comprise and regulates the group of data, management, and use
of data, which consist of software, hardware, people, techniques
of handling database, and the data also.

• Hardware in a database environment means the computers and


computer peripherals that are being used to manage a database

• Software means the whole thing right from the operating system
(OS) to the application programs that include database
management software like M.S. Access or SQL Server.
The Database System Environment
DB Components
Centralized Architecture
Two Tier Architecture
Three Tier Architecture
Overall architecture of DBMS
DBMS COMPONENT MODULES
DBMS System Utilities
DBMS System Utilities cont..
Other Tools
DBMS architecture
• A Database store a lot of critical information to access
data quickly and securely. Hence it is important to
select a correct Architecture for efficient data
management.
• DBMS architecture depends upon how users are
connected to the database to get their request done.
• Database management systems are divided into
multiple levels of abstraction for proper functioning.
Types of DBMS Architecture
• Centralized Architecture
• Client/Server Architectures
Centralized Architecture
• one in which all data is stored on a single server, and all
clients connect to that server in order to access and
manipulate the data.
• In older systems, most users accessed the DBMS via
computer terminals that did not have processing power
and only provided display capabilities.
Centralized Architecture
Basic Client Server Architecture
Client Server Architectures
Terms-Client,Server
• A client in this framework is typically a user machine that
provides user interface capabilities and local processing.
When a client requires access to additional functionality—
such as database access—that does not exist at the client,
it connects to a server that provides the needed
functionality.
• A server is a system containing both hardware and
software that can provide services to the client machines,
such as file access, printing, archiving, or database access.
• In general, some machines install only client software,
others only server software, and still others may include
both client and server software.
Highlights of 1-Tier Architecture
• Simplest DBMS architecture.
• All the components of DBMS, i.e., the server, database,
and client, reside on a single system.
• The user can directly access the database.
• Used when data isn't changing frequently.
• Suitable for programmers, database designers, and
single-user access.
Two-Tier Client Server Architecture
Two-Tier Client Server Architecture
Highlights of 2-Tier Architecture
• Multiple users can use it at the same time. Hence, it
can be used in an organization.
• It has high processing ability as the database
functionality is handled by the server alone.
• Faster access to the database due to the direct
connection and improved performance.
• Because of the two independent layers, it's easier to
maintain
Disadvantages of 2-Tier
• Scalability - As the number of clients increases, the
load on the server increases. Thereby declining the
performance of the DBMS and, in turn, the client-side
application.

• Security - The Direct connection between the client


and server systems makes this architecture vulnerable
to attacks.
Three-Tier Client Server Architecture
Highlights of 3-tier architecture
• Most widely used DBMS architecture.
• Follows Client-Application-Server architecture.
• Enhanced security, data integrity, and scalability.
Disadvantages
• Has complexity and maintenance issues because of the
extra layer.
Overall architecture of DBMS
The Storage Manager
The Storage Manager
• Buffer Manager----Fetching the data to memory ..cache
memory.Also handles size of data
• Filemanager----Allocates space on the storage and deals
with data structure
• Authorization and Integrity Manager---looks after
authorization commands and constraints(such as bank
balance should not be less than o)
• Transaction Manager—Checks Db remains consistent.Deals
with concurrent transactions without conflicts.

You might also like