SlideShare a Scribd company logo
18CSC303J - DATABASE
MANAGEMENT SYSTEMS
UNIT -1 INTRODUCTION
INTRODUCTION
• Data
• Data is information (or) set of values that has been
gathered and translated for some purpose, usually
analysis.
• It can be any character, including text, numbers,
pictures, sound and video suitable for use with a
computer.
• Database
• A database is a collection of information that is
organized so that it can be easily accessed, managed
and updated.
File Processing
System
• A File Processing System is a collection of data, files
and records.
• In initial days, these records were stored in the form
of files. (Papers and notepad etc..)
• Each fields of information separated by space, tab,
comma, semicolon or any other symbol.
• Before DBMS were introduced, organizations usually
stored information in such systems.
Disadvantages of
FPS
• Data redundancy
• It is possible that the same information may be
duplicated in different files. This leads to data
redundancy. It results in memory wastage.
• Data inconsistency
• data may not be in consistent state.
• Difficulty in accessing data
• Accessing data is not convenient and efficient in
conventional file processing system.
Disadvantages of
FPS
• Data Isolation
• Data are separated in various files.
• Different files may have different formats.
• These files may be stored in different folders or
different computers.
• So, due to this data isolation, it is difficult to share
data among different applications.
• Integrity problems
• It refers to the accuracy and consistency of data
stored in a database.
• Data values stored in the database must satisfy
certain types of constraints.
Disadvantages of
FPS
• Atomicity problems
• File system does not guarantee the atomicity.
• If there is any failure to insert, update or delete in
the file system, there is no mechanism to switch
back to the previous state.
• Concurrent-access anomalies
• Multiple users are allowed to access data
simultaneously for better performance and faster
response.
• In the file system, concurrent access leads to
incorrect data.
Disadvantages of
FPS
• Security problems
• Not every user of the database system should be
able to access all the data.
Comparison
File Processing System
• File-based system
caused data
redundancy. The data
may be duplicated in
different files
• File –based system
caused data
inconsistency. The data
in different files may be
different that cause
data inconsistency.
DBMS
• Database system
control data
redundancy. The data
appeared only once in
the system.
• In database system
data always consistent.
Because data appeared
only once.
Comparison
File Processing System
• The data cannot be
shared because data is
distributed in different
files.
• File based system does
not provide
consistency constrains
DBMS
• In database data is
easily shared because
data is stored at one
place.
• Database system
provides a different
consistency constrains
to maintain data
integrity in the system
Comparison
File Processing System
• The cost of file
processing system is
less then database
system.
• File based system does
not provide
concurrency facility.
• File based system does
not provide data
atomicity functionality.
DBMS
• The cost of database
system is much more
than a file processing
system.
• Database system
provides concurrency
facility.
• Database system
provides data
atomicity functionality
PURPOSE OF
DATABASE SYSTEMS
• In the early days, database applications were built on top
of file systems
• Drawbacks of using file systems to store data:
• Data redundancy and inconsistency
• Multiple file formats, duplication of information in
different files
• Difficulty in accessing data
• Need to write a new program to carry out each new
task
• Data isolation — multiple files and formats
• Integrity problems
• Integrity constraints (e.g. account balance > 0)
become part of program code
• Hard to add new constraints or change existing ones
PURPOSE OF
DATABASE SYSTEMS
• Drawbacks of using file systems (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
• Database systems offer solutions to all the above problems
Database
Applications
• Banking: transactions
• Airlines: reservations, schedules
• Universities: registration, grades
• Sales: customers, products, purchases
• Online retailers: order tracking, customized
recommendations
• Manufacturing: production, inventory, orders, supply
chain
• Human resources: employee records, salaries, tax
deductions
Elements of Database
• Tables
• Data Types - what types of
data will be stored inside
each and every table
column when creating a
SQL table.
• Constraints - maintain
the data integrity during
an update/delete/insert
into a table.
• Indexes - an use to speed
up data retrieval.
• Procedures and Views
UNIT machine learning  unit 1,algorithm pdf
Elements of Database
• Databases can be classified according to types of
content and organizational approach
• Bibliographic - contains list of books with authors
and publishers
Elements of Database
• full-text - contains complete text of books, thesis,
journals, magazines, newspapers and other kind of
textual documents(BLOB) E.g. Libraries
• Numeric
• Multimedia - images, graphic objects, drawings,
sketches, audio and video(BLOB).
Types of Databases
• Centralized database - A centralized database is
a database that is located, stored, and maintained in a
single location.
• E.g. desktop or server CPU, or a mainframe computer.
Types of Databases
• Distributed database - set of databases stored on
multiple computers. The data on several computers
can be simultaneously accessed and modified using a
network. Each database server in the distributed
database is controlled by its local DBMS
Types of Databases
• Object-oriented programming database
• Operational database
• End-user database
• Commercial database
• Personal database
DATABASE
MANAGEMENT
SYSTEM
• DBMS is a computer software that managing all
databases that are currently installed on a system
hard drive or network.
• MySQL Database
• Oracle Database
• Red Brick
• Microsoft SQL Server
• File Maker
Data Model
• Basic structure of a database is called data model.
• A data model is a set of tables, linked by relationships.
• Data models define how data is connected to each
other and how they are processed and stored inside
the system.
• The data models can be classified into four different
categories
• Relational Model
• Entity-Relationship Model
• Object-Based Data Model
• Semistructured Data Model
Relational Model
• Relational database
• All data must be stored in tables called relations
with rows and columns.
• Relations can be normalized(No Duplication).
• Relationship is maintained by storing a common
field.
Relational Model
E-R Model
• An entity relationship model, also called an entity-
relationship(ER) diagram, is a graphical
representation of entities and their relationships to
each other.
E-R Model
Object-Based Data
Model.
• Another method of representing real world objects.
• It considers each entity in the world as objects and
isolates it from each other.
• Object-oriented programming (especially in Java, C++,
or C#) has become the dominant software-
development methodology. Describe the state and
behavior of the object.
Object-Based Data
Model.
Semistructured
Data Model
• The XML Language is
widely used to
represent semi
structured data.
• Semistructured model
is a database
model where there is
no separation between
the data and the schema
SEMISTRUCTURED
DATA MODEL
Data Catalog
• The database catalog of a database instance consists
of metadata containing database object definitions
like base tables, synonyms, views and indexes.
Data Abstraction
• For the system to be usable, it must retrieve data
efficiently.
• Database systems are made-up of complex data
structures.
• To ease the user interaction with database, the
developers hide internal irrelevant details from users.
• This process of hiding irrelevant details from user is
called data abstraction. several levels of abstraction..
• View level
• Logical level
• Physical level
Data Abstraction –
VIEW OF DATA
Data Abstraction
• View level
• Highest level of data abstraction. This level
describes the user interaction with database
system.
• Example
• At view level, user just interact with system with
the help of GUI and enter the details at the screen,
they are not aware of how the data is stored and
what data is stored.
Data Abstraction
• Logical level
• This is the middle level of 3-level data abstraction
architecture. It describes what data is stored in
database.
• Example
• At the logical level these records can be described
as fields and attributes along with their data types.
The programmers generally work at this level
because they are aware of such things about
database systems.
Data Abstraction
• Physical level
• This is the lowest level of data abstraction. It
describes how data is actually stored in database.
You can get the complex data structure details at
this level.
• Example
• Let’s consider storing customer information in a
customer table. At physical level these records can
be described as blocks of storage (bytes, gigabytes,
terabytes etc.) in memory. These details are often
hidden from the programmers.
DBMS Architecture
DBMS Architecture
• 2-tier DBMS Architecture
• 2-tier DBMS architecture includes an Application
layer between the user and the DBMS, which is
responsible to communicate the user's request to
the DBMS and then send the response to the user
from the DBMS.
• An application interface known as ODBC(Open
Database Connectivity) provides an API that allow
client side program to call the DBMS.
• Client application – on which remote database users
work.
• Server application – on which the database system
runs.
DBMS Architecture
• 3-tier DBMS Architecture
• The objective of the three level architecture is to
separate each user's view of the database from the
Way the database is physically represented.
• In a 3-tier architecture, the client machine acts as a
front end application and does not contain any direct
database calls.
• Instead, the client end communicates with an
application server, usually through a forms
interface.
DBMS System
Structure
DBMS System
Structure
• A primary goal of a database system is to retrieve
information from database and store information into
the database.
• People who work with a database can be categorized
as database users or database administrators.
• Different types of user interfaces have been designed
for the different types of users.
• There are four different types of database-system
users can be classified.
DBMS System
Structure
• Naive users Any user who does not have any
knowledge about database. There task is to just use
the developed application and get the desired results.
• Application programmers are computer professionals
who write application programs. They can choose
many tools to develop user interfaces.
• Sophisticated users interact with the system without
writing programs. Instead, they form their requests
either using a database query language or by using
tools.
DBMS System
Structure
• DBA (Database Administrator)
• DBA can be a single person or it can be a group of
person.
• Database Administrator is responsible for
everything that is related to database.
• He makes the policies, strategies and provides
technical supports.
DBMS System
Structure
• Query Processor Components
• DML Compiler
• It translates DML statements into low level
instructions(Binary language) that query
evaluation engine understands.
• Embedded DML Pre-compiler
• It converts DML statements to normal procedure
calls. The Pre-compiler must interact with the DML
compiler to generate the appropriate code(host
language).
DBMS System
Structure
• DDL Interpreter
• It interprets the DDL statements and records them
in a set of tables containing meta data or data
dictionary.
• Query Evaluation Engine
• It executes low-level instructions generated by the
DML compiler.
• Storage Manager Components
• They provide the interface between the disk
storage and query processor.
• Authorization and Integrity Manager
• It tests for the satisfaction of integrity constraints
checks the authority of users to access data.
DBMS System
Structure
• Transaction Manager
• It ensures that the database remains in a consistent
state despite the system failures and that
concurrent transaction execution proceeds without
conflicting.
• File Manager
• It manages the allocation of space on disk storage.
• Buffer Manager
• It is responsible for fetching data from disk storage
into main memory and deciding what data to cache
in memory.
DBMS System
Structure
• Disk Storage
• Data Files
• It stores the database files(Binary format)
• Data Dictionary
• It stores meta data (data about data) about the
structure of the database.
• Indices
• Provide fast access to data items that hold particular
values.
• Statistical Data
• It stores statistical information about the data in the
database. This information is used by query processor
to select efficient ways to execute query.
DATABASE
LANGUAGES
TWO TYPES:
• Data Definition Language (DDL)
• Data Manipulation Language (DML)
DDL:
DDL or Data Definition Language actually consists of
the SQL commands that can be used to define the
database schema.
It simply deals with descriptions of the database
schema and is used to create and modify the
structure of database objects in the database.
Data Definition
Language (DDL)
• Specification notation for defining the database schema
• E.g.
create table account (
account-number char(10),
balance integer)
• DDL compiler generates a set of tables stored in a data
dictionary
• Data dictionary contains metadata (i.e., data about data)
• database schema
• Data storage and definition language
• language in which the storage structure and access
methods used by the database system are specified
• Usually an extension of the data definition language
Data Manipulation
Language (DML)
• Language for accessing and manipulating the data
organized by the appropriate data model
• DML also known as query language
• Two classes of languages
• Procedural – user specifies what data is required
and how to get those data
• Nonprocedural – user specifies what data is
required without specifying how to get those data
• SQL is the most widely used query language
SQL
• SQL: widely used non-procedural language
• E.g. find the name of the customer with customer-id
192-83-7465
select customer.customer-name
from customer
where customer.customer-id = ‘192-83-7465’
• E.g. find the balances of all accounts held by the customer
with customer-id 192-83-7465
select account.balance
from depositor, account
where depositor.customer-id = ‘192-83-7465’ and
depositor.account-number = account.account-
number
• Application programs generally access databases through one of
• Language extensions to allow embedded SQL
• Application program interface (e.g. ODBC/JDBC) which allow
SQL queries to be sent to a database
SQL- STRUCTURED
QUERY LANGUAGE
• Structured Query Language(SQL) as we all know is
the database language by the use of which we can
perform certain operations on the existing database
and also we can use this language to create a
database. SQL uses certain commands like Create,
Drop, Insert etc. to carry out the required tasks.
• These SQL commands are mainly categorized into
four categories as:
1. DDL – Data Definition Language
2. DQl – Data Query Language
3. DML – Data Manipulation Language
4. DCL – Data Control Language
UNIT machine learning  unit 1,algorithm pdf
DDL(Data Definition Language) : DDL or Data Definition
Language actually consists of the SQL commands that can be
used to define the database schema. It simply deals with
descriptions of the database schema and is used to create and
modify the structure of database table in the database.
Examples of DDL commands:
• CREATE – is used to create the database or its objects (like
table, index, function, views, store procedure and triggers).
• DROP – is used to delete table from the database.
• ALTER-is used to alter the structure of the database.
• TRUNCATE–is used to remove all records from a table,
including all spaces allocated for the records are removed.
• COMMENT –is used to add comments to the data dictionary.
• RENAME –is used to rename an table existing in the
database.
CREATE
CREATE TABLE TABLE_NAME (COLUMN_NAME D
ATATYPES[,....]);
DROP
DROP TABLE TABLE NAME;
ALTER (ADD NEW COLUMN)
ALTER TABLE table_name ADD column_name CO
LUMN-de nition;
ALTER (MODIFY)
ALTER TABLE MODIFY(COLUMN DEFINITION....);
TRUNCATE:
TRUNCATE TABLE TABLE NAME;
RENAME:
RENAME OLD TABLE NAME TO NEW TABLE
NAME;
DQL (Data Query Language) :
• DML statements are used for performing queries on
the data within schema objects. The purpose of
DQL Command is to get some schema relation
based on the query passed to it.
• Example of DQL:
• SELECT – is used to retrieve data from the a
database.
SELECT * FROM TABLE NAME;
DML(Data Manipulation Language) : The SQL
commands that deals with the manipulation of data
present in the database belong to DML or Data
Manipulation Language and this includes most of the
SQL statements.Examples of DML:
• INSERT – is used to insert data into a table.
• UPDATE – is used to update existing data within a
table.
• DELETE – is used to delete records from a
database table.
INSERT:
INSERT INTO TABLE_NAME
(col1, col2, col3,.... col N)
VALUES (value1, value2, value3, .... valueN);
INSERT:
INSERT INTO TABLE_NAME
VALUES (value1, value2, value3, .... valueN);
• For example:
UPDATE:
UPDATE table_name SET [column_name1= value1,
...column_nameN = valueN] [WHERE CONDITION]
DELETE:
DELETE FROM table_name [WHERE condition];
DCL(Data Control Language) : DCL includes
commands such as GRANT and REVOKE which
mainly deals with the rights, permissions and other
controls of the database system.Examples of DCL
commands:
• GRANT-gives user’s access privileges to database.
• REVOKE-withdraw user’s access privileges given
by using the GRANT command.
GRANT:
GRANT SELECT,
UPDATE ON MY_TABLE TO SOME_USER,
ANOTHER_USER;
REVOKE:
REVOKE SELECT,
UPDATE ON MY_TABLE FROM USER1, USER2;
TCL(transaction Control Language) : TCL
commands deals with the transaction within the
database.Examples of TCL commands:
• COMMIT– commits (SAVE) a Transaction.
• ROLLBACK– rollbacks a transaction in case of any
error occurs.
• SAVEPOINT–sets a savepoint within a transaction.
ie) It is used to roll the transaction back to a ce ain point without
rolling back the entire transaction.
• SET TRANSACTION–specify characteristics for the
transaction.
COMMIT:
COMMIT;
ROLLBACK:
ROLLBACK;
SAVEPOINT:
SAVEPOINT SAVEPOINT_NAME;
Database Users
• Users are differentiated by the way they expect to
interact with the system
• Application programmers – interact with system
through DML calls
• Sophisticated users – form requests in a database
query language
• Specialized users – write specialized database
applications that do not fit into the traditional data
processing framework
• Naïve users – invoke one of the permanent
application programs that have been written
previously
– E.g. people accessing database over the web, bank
tellers, clerical staff
Database
Administrator
• Coordinates all the activities of the database system;
the database administrator has a good understanding
of the enterprise’s information resources and needs.
• Database administrator's duties include:
– Schema definition
– Storage structure and access method definition
– Schema and physical organization modification
– Granting user authority to access the database
– Specifying integrity constraints
– Acting as liaison with users
– Monitoring performance and responding to
changes in requirements
Data Independence
• Data independence can be explained using the
three-schema architecture.
• Data independence refers characteristic of being
able to modify the schema at one level of the
database system without altering the schema at
the next higher level.
ere are two types of data independence:
1.Logical Data Independence
2. Physical Data Independence
Logical Data Independence
• Logical data independence refers characteristic
of being able to change the conceptual schema
without having to change the external schema.
• Logical data independence is used to separate
the external level from the conceptual view.
• If we do any changes in the conceptual view of
the data, then the user view of the data would
not be a ected.
• Logical data independence occurs at the user
inte ace level.
Physical Data Independence
• Physical data independence can be de ned as the
capacity to change the internal schema without
having to change the conceptual schema.
• If we do any changes in the storage size of the
database system se er, then the Conceptual
structure of the database will not be a ected.
• Physical data independence is used to separate
conceptual levels from the internal levels.
• Physical data independence occurs at the logical
inte ace level.
UNIT machine learning  unit 1,algorithm pdf

More Related Content

Similar to UNIT machine learning unit 1,algorithm pdf (20)

PPT
Basics of Database Management System: Key Components
halima9709
 
PDF
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
PPTX
advanced database management system by uni
VaibhavSrivastav52
 
PPT
Advanced Database Management System_Introduction Slide.ppt
BikalAdhikari4
 
PDF
Database management systems notes for unit 1
Priyadarshini803769
 
PPTX
Lecture 1 to 3intro to normalization in database
maqsoodahmedbscsfkhp
 
PPTX
• Introduce ER data model, database design and normalization
krishnaiotgnitc
 
PPTX
DATABASE MANAGENT SYSYEMS OVERALL DESCTPTION OF DBMS
krishnaiotgnitc
 
PPTX
20CS402_Unit_1.pptx
Sathishkumar Jaganathan
 
PPT
DBMS Lecture 1.ppt
MohsinBajwa18
 
PPTX
Module-1.pptx
SridharChowdary10
 
PPTX
Introduction to database
gagan bhattarai
 
PPTX
REC-UNIT-I-DataBaseManagementSystems.pptx
Uma Kakarlapudi
 
PDF
Ch-1-Introduction-to-Database.pdf
MrjJoker1
 
PPT
INTRODUCTION TO RDBMS
Vidhya Balan
 
PDF
Introduction to Databases and Transactions
نبيله نواز
 
PPTX
Database_Systems_(CSC_206)_-_2024-2025_STU_PT_1.pptx
abdulmuminbraimah
 
PDF
Database & Database Users
M.Zalmai Rahmani
 
PPTX
Introduction to Database
Siti Ismail
 
PDF
database introductoin optimization1-app6891.pdf
parveen204931475
 
Basics of Database Management System: Key Components
halima9709
 
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
advanced database management system by uni
VaibhavSrivastav52
 
Advanced Database Management System_Introduction Slide.ppt
BikalAdhikari4
 
Database management systems notes for unit 1
Priyadarshini803769
 
Lecture 1 to 3intro to normalization in database
maqsoodahmedbscsfkhp
 
• Introduce ER data model, database design and normalization
krishnaiotgnitc
 
DATABASE MANAGENT SYSYEMS OVERALL DESCTPTION OF DBMS
krishnaiotgnitc
 
20CS402_Unit_1.pptx
Sathishkumar Jaganathan
 
DBMS Lecture 1.ppt
MohsinBajwa18
 
Module-1.pptx
SridharChowdary10
 
Introduction to database
gagan bhattarai
 
REC-UNIT-I-DataBaseManagementSystems.pptx
Uma Kakarlapudi
 
Ch-1-Introduction-to-Database.pdf
MrjJoker1
 
INTRODUCTION TO RDBMS
Vidhya Balan
 
Introduction to Databases and Transactions
نبيله نواز
 
Database_Systems_(CSC_206)_-_2024-2025_STU_PT_1.pptx
abdulmuminbraimah
 
Database & Database Users
M.Zalmai Rahmani
 
Introduction to Database
Siti Ismail
 
database introductoin optimization1-app6891.pdf
parveen204931475
 

Recently uploaded (20)

PDF
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
PPTX
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
PPTX
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
PDF
apidays Singapore 2025 - Surviving an interconnected world with API governanc...
apidays
 
PDF
apidays Singapore 2025 - The API Playbook for AI by Shin Wee Chuang (PAND AI)
apidays
 
PPTX
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
PDF
A GraphRAG approach for Energy Efficiency Q&A
Marco Brambilla
 
PPTX
big data eco system fundamentals of data science
arivukarasi
 
PDF
The European Business Wallet: Why It Matters and How It Powers the EUDI Ecosy...
Lal Chandran
 
PPTX
01_Nico Vincent_Sailpeak.pptx_AI_Barometer_2025
FinTech Belgium
 
PDF
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
PPTX
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
PPTX
Feb 2021 Ransomware Recovery presentation.pptx
enginsayin1
 
PPTX
Powerful Uses of Data Analytics You Should Know
subhashenia
 
PPTX
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
PPTX
apidays Singapore 2025 - The Quest for the Greenest LLM , Jean Philippe Ehre...
apidays
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PDF
InformaticsPractices-MS - Google Docs.pdf
seshuashwin0829
 
PDF
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
PDF
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
apidays Singapore 2025 - Surviving an interconnected world with API governanc...
apidays
 
apidays Singapore 2025 - The API Playbook for AI by Shin Wee Chuang (PAND AI)
apidays
 
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
A GraphRAG approach for Energy Efficiency Q&A
Marco Brambilla
 
big data eco system fundamentals of data science
arivukarasi
 
The European Business Wallet: Why It Matters and How It Powers the EUDI Ecosy...
Lal Chandran
 
01_Nico Vincent_Sailpeak.pptx_AI_Barometer_2025
FinTech Belgium
 
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
Feb 2021 Ransomware Recovery presentation.pptx
enginsayin1
 
Powerful Uses of Data Analytics You Should Know
subhashenia
 
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
apidays Singapore 2025 - The Quest for the Greenest LLM , Jean Philippe Ehre...
apidays
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
InformaticsPractices-MS - Google Docs.pdf
seshuashwin0829
 
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
Ad

UNIT machine learning unit 1,algorithm pdf

  • 1. 18CSC303J - DATABASE MANAGEMENT SYSTEMS UNIT -1 INTRODUCTION
  • 2. INTRODUCTION • Data • Data is information (or) set of values that has been gathered and translated for some purpose, usually analysis. • It can be any character, including text, numbers, pictures, sound and video suitable for use with a computer. • Database • A database is a collection of information that is organized so that it can be easily accessed, managed and updated.
  • 3. File Processing System • A File Processing System is a collection of data, files and records. • In initial days, these records were stored in the form of files. (Papers and notepad etc..) • Each fields of information separated by space, tab, comma, semicolon or any other symbol. • Before DBMS were introduced, organizations usually stored information in such systems.
  • 4. Disadvantages of FPS • Data redundancy • It is possible that the same information may be duplicated in different files. This leads to data redundancy. It results in memory wastage. • Data inconsistency • data may not be in consistent state. • Difficulty in accessing data • Accessing data is not convenient and efficient in conventional file processing system.
  • 5. Disadvantages of FPS • Data Isolation • Data are separated in various files. • Different files may have different formats. • These files may be stored in different folders or different computers. • So, due to this data isolation, it is difficult to share data among different applications. • Integrity problems • It refers to the accuracy and consistency of data stored in a database. • Data values stored in the database must satisfy certain types of constraints.
  • 6. Disadvantages of FPS • Atomicity problems • File system does not guarantee the atomicity. • If there is any failure to insert, update or delete in the file system, there is no mechanism to switch back to the previous state. • Concurrent-access anomalies • Multiple users are allowed to access data simultaneously for better performance and faster response. • In the file system, concurrent access leads to incorrect data.
  • 7. Disadvantages of FPS • Security problems • Not every user of the database system should be able to access all the data.
  • 8. Comparison File Processing System • File-based system caused data redundancy. The data may be duplicated in different files • File –based system caused data inconsistency. The data in different files may be different that cause data inconsistency. DBMS • Database system control data redundancy. The data appeared only once in the system. • In database system data always consistent. Because data appeared only once.
  • 9. Comparison File Processing System • The data cannot be shared because data is distributed in different files. • File based system does not provide consistency constrains DBMS • In database data is easily shared because data is stored at one place. • Database system provides a different consistency constrains to maintain data integrity in the system
  • 10. Comparison File Processing System • The cost of file processing system is less then database system. • File based system does not provide concurrency facility. • File based system does not provide data atomicity functionality. DBMS • The cost of database system is much more than a file processing system. • Database system provides concurrency facility. • Database system provides data atomicity functionality
  • 11. PURPOSE OF DATABASE SYSTEMS • In the early days, database applications were built on top of file systems • Drawbacks of using file systems to store data: • Data redundancy and inconsistency • Multiple file formats, duplication of information in different files • Difficulty in accessing data • Need to write a new program to carry out each new task • Data isolation — multiple files and formats • Integrity problems • Integrity constraints (e.g. account balance > 0) become part of program code • Hard to add new constraints or change existing ones
  • 12. PURPOSE OF DATABASE SYSTEMS • Drawbacks of using file systems (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 • Database systems offer solutions to all the above problems
  • 13. Database Applications • Banking: transactions • Airlines: reservations, schedules • Universities: registration, grades • Sales: customers, products, purchases • Online retailers: order tracking, customized recommendations • Manufacturing: production, inventory, orders, supply chain • Human resources: employee records, salaries, tax deductions
  • 14. Elements of Database • Tables • Data Types - what types of data will be stored inside each and every table column when creating a SQL table. • Constraints - maintain the data integrity during an update/delete/insert into a table. • Indexes - an use to speed up data retrieval. • Procedures and Views
  • 16. Elements of Database • Databases can be classified according to types of content and organizational approach • Bibliographic - contains list of books with authors and publishers
  • 17. Elements of Database • full-text - contains complete text of books, thesis, journals, magazines, newspapers and other kind of textual documents(BLOB) E.g. Libraries • Numeric • Multimedia - images, graphic objects, drawings, sketches, audio and video(BLOB).
  • 18. Types of Databases • Centralized database - A centralized database is a database that is located, stored, and maintained in a single location. • E.g. desktop or server CPU, or a mainframe computer.
  • 19. Types of Databases • Distributed database - set of databases stored on multiple computers. The data on several computers can be simultaneously accessed and modified using a network. Each database server in the distributed database is controlled by its local DBMS
  • 20. Types of Databases • Object-oriented programming database • Operational database • End-user database • Commercial database • Personal database
  • 21. DATABASE MANAGEMENT SYSTEM • DBMS is a computer software that managing all databases that are currently installed on a system hard drive or network. • MySQL Database • Oracle Database • Red Brick • Microsoft SQL Server • File Maker
  • 22. Data Model • Basic structure of a database is called data model. • A data model is a set of tables, linked by relationships. • Data models define how data is connected to each other and how they are processed and stored inside the system. • The data models can be classified into four different categories • Relational Model • Entity-Relationship Model • Object-Based Data Model • Semistructured Data Model
  • 23. Relational Model • Relational database • All data must be stored in tables called relations with rows and columns. • Relations can be normalized(No Duplication). • Relationship is maintained by storing a common field.
  • 25. E-R Model • An entity relationship model, also called an entity- relationship(ER) diagram, is a graphical representation of entities and their relationships to each other.
  • 27. Object-Based Data Model. • Another method of representing real world objects. • It considers each entity in the world as objects and isolates it from each other. • Object-oriented programming (especially in Java, C++, or C#) has become the dominant software- development methodology. Describe the state and behavior of the object.
  • 29. Semistructured Data Model • The XML Language is widely used to represent semi structured data. • Semistructured model is a database model where there is no separation between the data and the schema
  • 31. Data Catalog • The database catalog of a database instance consists of metadata containing database object definitions like base tables, synonyms, views and indexes.
  • 32. Data Abstraction • For the system to be usable, it must retrieve data efficiently. • Database systems are made-up of complex data structures. • To ease the user interaction with database, the developers hide internal irrelevant details from users. • This process of hiding irrelevant details from user is called data abstraction. several levels of abstraction.. • View level • Logical level • Physical level
  • 34. Data Abstraction • View level • Highest level of data abstraction. This level describes the user interaction with database system. • Example • At view level, user just interact with system with the help of GUI and enter the details at the screen, they are not aware of how the data is stored and what data is stored.
  • 35. Data Abstraction • Logical level • This is the middle level of 3-level data abstraction architecture. It describes what data is stored in database. • Example • At the logical level these records can be described as fields and attributes along with their data types. The programmers generally work at this level because they are aware of such things about database systems.
  • 36. Data Abstraction • Physical level • This is the lowest level of data abstraction. It describes how data is actually stored in database. You can get the complex data structure details at this level. • Example • Let’s consider storing customer information in a customer table. At physical level these records can be described as blocks of storage (bytes, gigabytes, terabytes etc.) in memory. These details are often hidden from the programmers.
  • 38. DBMS Architecture • 2-tier DBMS Architecture • 2-tier DBMS architecture includes an Application layer between the user and the DBMS, which is responsible to communicate the user's request to the DBMS and then send the response to the user from the DBMS. • An application interface known as ODBC(Open Database Connectivity) provides an API that allow client side program to call the DBMS. • Client application – on which remote database users work. • Server application – on which the database system runs.
  • 39. DBMS Architecture • 3-tier DBMS Architecture • The objective of the three level architecture is to separate each user's view of the database from the Way the database is physically represented. • In a 3-tier architecture, the client machine acts as a front end application and does not contain any direct database calls. • Instead, the client end communicates with an application server, usually through a forms interface.
  • 41. DBMS System Structure • A primary goal of a database system is to retrieve information from database and store information into the database. • People who work with a database can be categorized as database users or database administrators. • Different types of user interfaces have been designed for the different types of users. • There are four different types of database-system users can be classified.
  • 42. DBMS System Structure • Naive users Any user who does not have any knowledge about database. There task is to just use the developed application and get the desired results. • Application programmers are computer professionals who write application programs. They can choose many tools to develop user interfaces. • Sophisticated users interact with the system without writing programs. Instead, they form their requests either using a database query language or by using tools.
  • 43. DBMS System Structure • DBA (Database Administrator) • DBA can be a single person or it can be a group of person. • Database Administrator is responsible for everything that is related to database. • He makes the policies, strategies and provides technical supports.
  • 44. DBMS System Structure • Query Processor Components • DML Compiler • It translates DML statements into low level instructions(Binary language) that query evaluation engine understands. • Embedded DML Pre-compiler • It converts DML statements to normal procedure calls. The Pre-compiler must interact with the DML compiler to generate the appropriate code(host language).
  • 45. DBMS System Structure • DDL Interpreter • It interprets the DDL statements and records them in a set of tables containing meta data or data dictionary. • Query Evaluation Engine • It executes low-level instructions generated by the DML compiler. • Storage Manager Components • They provide the interface between the disk storage and query processor. • Authorization and Integrity Manager • It tests for the satisfaction of integrity constraints checks the authority of users to access data.
  • 46. DBMS System Structure • Transaction Manager • It ensures that the database remains in a consistent state despite the system failures and that concurrent transaction execution proceeds without conflicting. • File Manager • It manages the allocation of space on disk storage. • Buffer Manager • It is responsible for fetching data from disk storage into main memory and deciding what data to cache in memory.
  • 47. DBMS System Structure • Disk Storage • Data Files • It stores the database files(Binary format) • Data Dictionary • It stores meta data (data about data) about the structure of the database. • Indices • Provide fast access to data items that hold particular values. • Statistical Data • It stores statistical information about the data in the database. This information is used by query processor to select efficient ways to execute query.
  • 48. DATABASE LANGUAGES TWO TYPES: • Data Definition Language (DDL) • Data Manipulation Language (DML)
  • 49. DDL: DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database.
  • 50. Data Definition Language (DDL) • Specification notation for defining the database schema • E.g. create table account ( account-number char(10), balance integer) • DDL compiler generates a set of tables stored in a data dictionary • Data dictionary contains metadata (i.e., data about data) • database schema • Data storage and definition language • language in which the storage structure and access methods used by the database system are specified • Usually an extension of the data definition language
  • 51. Data Manipulation Language (DML) • Language for accessing and manipulating the data organized by the appropriate data model • DML also known as query language • Two classes of languages • Procedural – user specifies what data is required and how to get those data • Nonprocedural – user specifies what data is required without specifying how to get those data • SQL is the most widely used query language
  • 52. SQL • SQL: widely used non-procedural language • E.g. find the name of the customer with customer-id 192-83-7465 select customer.customer-name from customer where customer.customer-id = ‘192-83-7465’ • E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465 select account.balance from depositor, account where depositor.customer-id = ‘192-83-7465’ and depositor.account-number = account.account- number • Application programs generally access databases through one of • Language extensions to allow embedded SQL • Application program interface (e.g. ODBC/JDBC) which allow SQL queries to be sent to a database
  • 53. SQL- STRUCTURED QUERY LANGUAGE • Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. SQL uses certain commands like Create, Drop, Insert etc. to carry out the required tasks. • These SQL commands are mainly categorized into four categories as: 1. DDL – Data Definition Language 2. DQl – Data Query Language 3. DML – Data Manipulation Language 4. DCL – Data Control Language
  • 55. DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database table in the database. Examples of DDL commands: • CREATE – is used to create the database or its objects (like table, index, function, views, store procedure and triggers). • DROP – is used to delete table from the database. • ALTER-is used to alter the structure of the database. • TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed. • COMMENT –is used to add comments to the data dictionary. • RENAME –is used to rename an table existing in the database.
  • 56. CREATE CREATE TABLE TABLE_NAME (COLUMN_NAME D ATATYPES[,....]); DROP DROP TABLE TABLE NAME; ALTER (ADD NEW COLUMN) ALTER TABLE table_name ADD column_name CO LUMN-de nition;
  • 57. ALTER (MODIFY) ALTER TABLE MODIFY(COLUMN DEFINITION....); TRUNCATE: TRUNCATE TABLE TABLE NAME; RENAME: RENAME OLD TABLE NAME TO NEW TABLE NAME;
  • 58. DQL (Data Query Language) : • DML statements are used for performing queries on the data within schema objects. The purpose of DQL Command is to get some schema relation based on the query passed to it. • Example of DQL: • SELECT – is used to retrieve data from the a database. SELECT * FROM TABLE NAME;
  • 59. DML(Data Manipulation Language) : The SQL commands that deals with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements.Examples of DML: • INSERT – is used to insert data into a table. • UPDATE – is used to update existing data within a table. • DELETE – is used to delete records from a database table.
  • 60. INSERT: INSERT INTO TABLE_NAME (col1, col2, col3,.... col N) VALUES (value1, value2, value3, .... valueN); INSERT: INSERT INTO TABLE_NAME VALUES (value1, value2, value3, .... valueN); • For example:
  • 61. UPDATE: UPDATE table_name SET [column_name1= value1, ...column_nameN = valueN] [WHERE CONDITION] DELETE: DELETE FROM table_name [WHERE condition];
  • 62. DCL(Data Control Language) : DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system.Examples of DCL commands: • GRANT-gives user’s access privileges to database. • REVOKE-withdraw user’s access privileges given by using the GRANT command.
  • 63. GRANT: GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USER, ANOTHER_USER; REVOKE: REVOKE SELECT, UPDATE ON MY_TABLE FROM USER1, USER2;
  • 64. TCL(transaction Control Language) : TCL commands deals with the transaction within the database.Examples of TCL commands: • COMMIT– commits (SAVE) a Transaction. • ROLLBACK– rollbacks a transaction in case of any error occurs. • SAVEPOINT–sets a savepoint within a transaction. ie) It is used to roll the transaction back to a ce ain point without rolling back the entire transaction. • SET TRANSACTION–specify characteristics for the transaction.
  • 66. Database Users • Users are differentiated by the way they expect to interact with the system • Application programmers – interact with system through DML calls • Sophisticated users – form requests in a database query language • Specialized users – write specialized database applications that do not fit into the traditional data processing framework • Naïve users – invoke one of the permanent application programs that have been written previously – E.g. people accessing database over the web, bank tellers, clerical staff
  • 67. Database Administrator • Coordinates all the activities of the database system; the database administrator has a good understanding of the enterprise’s information resources and needs. • Database administrator's duties include: – Schema definition – Storage structure and access method definition – Schema and physical organization modification – Granting user authority to access the database – Specifying integrity constraints – Acting as liaison with users – Monitoring performance and responding to changes in requirements
  • 68. Data Independence • Data independence can be explained using the three-schema architecture. • Data independence refers characteristic of being able to modify the schema at one level of the database system without altering the schema at the next higher level. ere are two types of data independence: 1.Logical Data Independence 2. Physical Data Independence
  • 69. Logical Data Independence • Logical data independence refers characteristic of being able to change the conceptual schema without having to change the external schema. • Logical data independence is used to separate the external level from the conceptual view. • If we do any changes in the conceptual view of the data, then the user view of the data would not be a ected. • Logical data independence occurs at the user inte ace level.
  • 70. Physical Data Independence • Physical data independence can be de ned as the capacity to change the internal schema without having to change the conceptual schema. • If we do any changes in the storage size of the database system se er, then the Conceptual structure of the database will not be a ected. • Physical data independence is used to separate conceptual levels from the internal levels. • Physical data independence occurs at the logical inte ace level.