SlideShare a Scribd company logo
Lecture 1-3
Introduction to Databases
Outline
Introduction
Traditional File Based system
File-Based Approach
Limitation of File Based system
Database Approach
Applications of Database System
View of Data
Data Abstraction
Instances and Schemas
Data Models
Database Languages
DML
DDL
Database Design
Design Process
The Entity-Relationship Model
Normalization
Data Storage and Querying
Storage Manager
The Query Processor
Transaction Management
Database Architecture
Database Users and Administrators
Introduction
What is Data?
Fact and Figures or distinct pieces of information
What is a database?
Collection of related data.
What is a database Management System?
Database systems give a set of tools for storing, searching and managing this
information
What is a database Application?
database application is simply a program that interacts with the database at
some point in its execution. It is an intermediary between user and DBMS.
Traditional File Based System
A collection of application programs that perform services for the end-users, such as
the production of reports. Each program defines and manages its own data.
Conventional file systems are inadequate as database systems, because they fail to
support efficient search, efficient modifications to small pieces of data, complex
queries, or atomic and independent execution of transactions.
File-Based Processing
© Pearson Education Limited 1995, 2005
Activity
Make a group of two people
Search on web or from your text book the limitation of the file based system.
Give presentation on it using board.
Limitation of File Based system
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:
Incompatible file formats
Programs are written in different languages, and so cannot easily access each other’s files.
Integrity problems
Integrity constraints (e.g. account balance > 0) become part of program code
Hard to add new constraints or change existing ones
Fixed Queries/Proliferation of application programs
Any new requirement needs a new program.
Limitation of File Based 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
Database systems offer solutions to all the above problems
Database Management System (DBMS)
© Pearson Education Limited 1995, 2005
Database Approach
Applications of Database-System
Enterprise Information: Sales, Accounting, Human Resource
Airline reservation systems: For reservation, scheduling
Banking systems: Credit and transaction, Finance
Telecommunication: records of calls, monthly bills, communication networks
Levels of Abstraction
Physical level describes how a record (e.g., customer) is stored.
Logical level: describes data stored in database, and the relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;
View level: application programs hide details of data types. Views can also hide
information (e.g., salary) for security purposes.
Lecture 1 to 3intro to  normalization in database
Lecture 1 to 3intro to  normalization in database
View of Data
• Allows each user to have his or her own view of the database.
• A view is essentially some subset of the database.
• An architecture for a database system
Views - Benefits
Reduce complexity
Provide a level of security
Provide a mechanism to customize the appearance of the database
Present a consistent, unchanging picture of the structure of the database, even if
the underlying database is changed
Instances and Schemas
Similar to types and variables in programming languages
Schema – the structure view (design) of the database
e.g., the database consists of information about a set of customers and accounts and the relationship between them)
Analogous to type information of a variable in a program
Physical schema: database design at the physical level
Logical schema: database design at the logical level
Instance – the actual content of the database at a particular point in time
Analogous to the value of a variable
Physical Data Independence – the ability to modify the physical schema without changing the logical schema
Applications depend on the logical schema
In general, the interfaces between the various levels and components should be well defined so that changes in some
parts do not seriously influence others.
Data Models
A collection of tools for describing
Data, Data relationships, Data semantics, Data constraints
A data model provides a way to describe the design of a database at the physical,
logical, and view levels. The data models can be classified into four different
categories:
Relational model
Entity-Relationship data model (mainly for database design)
Object-based data models (Object-oriented and Object-relational)
Semistructured data model (XML)
Other older models:
Network model
Hierarchical model
Entity-Relationship Model
Example of schema in the entity-relationship model
Relational Model
All the data is stored in various tables.
Example of tabular data in the relational model
Columns
Rows
A Sample Relational Database
Database Languages
Database system provides DDL to specify the database schema and DML to express
database queries and updates.
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)
Data storage and definition language
These statements define the implementation details of the database schemas, which are
usually hidden from the users.
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
Database Design
The process of designing the general structure of the database:
Specification: to characterize fully the data needs of the prospective database
users.
Conceptual Design: The focus at this point is on describing the data and their
relationships
Business decision – What attributes should we record in the database?
Computer Science decision – What relation schemas should we have and how
should the attributes be distributed among the various relation schemas?
There are principally two ways to tackle the problem.
entity-relationship model
Normalization: that takes as input the set of all attributes and generates a set of tables
Continue
The process of moving from an abstract data model to the implementation of the
database proceeds in two final design phases
Logical Design: designer maps the high-level conceptual schema onto the
implementation data model of the database system that will be used
Physical Design: the physical features of the database are specified. These features
include the form of file organization and the internal storage structures
Design Approaches
Need to come up with a methodology to ensure that each of the relations in the
database is “good”
Two ways of doing so:
Entity Relationship Model (Chapter 7)
Models an enterprise as a collection of entities and relationships
Represented diagrammatically by an entity-relationship diagram:
Normalization Theory (Chapter 8)
Formalize what designs are bad, and test for them
Database Engine
Storage manager
Query processing
Storage Management
Storage manager is a program module that provides the interface between the low-
level data stored in the database and the application programs and queries submitted
to the system.
The storage manager is responsible to the following tasks:
Interaction with the OS file manager
Efficient storing, retrieving and updating of data
Issues:
Storage access
File organization
Indexing and hashing
Query Processing
The query processor components include:
DDL interpreter, which interprets DDL statements and records the definitions
in the data dictionary.
DML compiler, which translates DML statements in a query language into an
evaluation plan consisting of low-level instructions that the query evaluation
engine understands.
The DML compiler also performs query optimization; that is, it picks the lowest cost
evaluation plan from among the alternatives.
Query evaluation engine, which executes low-level instructions generated by the
DML compiler.
Transaction Management
What if the system fails?
What if more than one user is concurrently updating the same data?
A transaction is a collection of operations that performs a single logical function in
a database application
Transaction-management component ensures that the database remains in a
consistent (correct) state despite system failures (e.g., power failures and
operating system crashes) and transaction failures.
Concurrency-control manager controls the interaction among the concurrent
transactions, to ensure the consistency of the database.
Database System Internals
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
Database Architecture
The architecture of a database systems is greatly influenced by
the underlying computer system on which the database is running:
Centralized
Client-server
Parallel (multi-processor)
Distributed
Application Architectures
Two-tier architecture: E.g. client programs using ODBC/JDBC to
communicate with a database
Three-tier architecture: E.g. web-based applications, and
applications built using “middleware”
Suggested Reading
Chapter 1 of Database System Concepts by Abraham Silberschatz
Chapter 1,2,3,4 of Database Systems: A Practical Approach to Design, Implementation,
and Management by Thomas Conolly
Ad

More Related Content

Similar to Lecture 1 to 3intro to normalization in database (20)

Ch1
Ch1Ch1
Ch1
CAG
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 
Database Management System, Lecture-1
Database Management System, Lecture-1Database Management System, Lecture-1
Database Management System, Lecture-1
Sonia Mim
 
Ch1- Introduction to dbms
Ch1- Introduction to dbmsCh1- Introduction to dbms
Ch1- Introduction to dbms
Shakila Mahjabin
 
Dbms 1
Dbms 1Dbms 1
Dbms 1
kartik_chell
 
21UCAC 41 Database Management System.ppt
21UCAC 41 Database Management System.ppt21UCAC 41 Database Management System.ppt
21UCAC 41 Database Management System.ppt
ssuser7f90ae
 
DIGITAL CONTENT for the help of students.pptx
DIGITAL CONTENT for the help of students.pptxDIGITAL CONTENT for the help of students.pptx
DIGITAL CONTENT for the help of students.pptx
aakashrathi20022016
 
Dbms models
Dbms modelsDbms models
Dbms models
devgocool
 
DBMS - Introduction
DBMS - IntroductionDBMS - Introduction
DBMS - Introduction
JOSEPHINE297640
 
27 fcs157al2
27 fcs157al227 fcs157al2
27 fcs157al2
CHANDRA BHUSHAN
 
Dbms
DbmsDbms
Dbms
saurav-IT
 
Database Management System Introduction
Database Management System IntroductionDatabase Management System Introduction
Database Management System Introduction
Smriti Jain
 
Abhishek_DBMS-ch1_Database_management.ppsx
Abhishek_DBMS-ch1_Database_management.ppsxAbhishek_DBMS-ch1_Database_management.ppsx
Abhishek_DBMS-ch1_Database_management.ppsx
SANJEETKUMAR378234
 
Data base management system
Data base management systemData base management system
Data base management system
Navneet Jingar
 
DBMS. Advantage of Data base management systems
DBMS. Advantage of Data base management systemsDBMS. Advantage of Data base management systems
DBMS. Advantage of Data base management systems
Dr Shailendra Bhalawe
 
Database Languages Architecture Data Model.pptx
Database Languages Architecture Data Model.pptxDatabase Languages Architecture Data Model.pptx
Database Languages Architecture Data Model.pptx
shahid1204as
 
DBMS
DBMSDBMS
DBMS
utkarshpathak41
 
Database systems - Chapter 2 (Remaining)
Database systems - Chapter 2 (Remaining)Database systems - Chapter 2 (Remaining)
Database systems - Chapter 2 (Remaining)
shahab3
 
Dbms
DbmsDbms
Dbms
Surkhab Shelly
 
dbms notes.ppt
dbms notes.pptdbms notes.ppt
dbms notes.ppt
Ranjit273515
 
Ch1
Ch1Ch1
Ch1
CAG
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 
Database Management System, Lecture-1
Database Management System, Lecture-1Database Management System, Lecture-1
Database Management System, Lecture-1
Sonia Mim
 
21UCAC 41 Database Management System.ppt
21UCAC 41 Database Management System.ppt21UCAC 41 Database Management System.ppt
21UCAC 41 Database Management System.ppt
ssuser7f90ae
 
DIGITAL CONTENT for the help of students.pptx
DIGITAL CONTENT for the help of students.pptxDIGITAL CONTENT for the help of students.pptx
DIGITAL CONTENT for the help of students.pptx
aakashrathi20022016
 
Database Management System Introduction
Database Management System IntroductionDatabase Management System Introduction
Database Management System Introduction
Smriti Jain
 
Abhishek_DBMS-ch1_Database_management.ppsx
Abhishek_DBMS-ch1_Database_management.ppsxAbhishek_DBMS-ch1_Database_management.ppsx
Abhishek_DBMS-ch1_Database_management.ppsx
SANJEETKUMAR378234
 
Data base management system
Data base management systemData base management system
Data base management system
Navneet Jingar
 
DBMS. Advantage of Data base management systems
DBMS. Advantage of Data base management systemsDBMS. Advantage of Data base management systems
DBMS. Advantage of Data base management systems
Dr Shailendra Bhalawe
 
Database Languages Architecture Data Model.pptx
Database Languages Architecture Data Model.pptxDatabase Languages Architecture Data Model.pptx
Database Languages Architecture Data Model.pptx
shahid1204as
 
Database systems - Chapter 2 (Remaining)
Database systems - Chapter 2 (Remaining)Database systems - Chapter 2 (Remaining)
Database systems - Chapter 2 (Remaining)
shahab3
 

Recently uploaded (20)

Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjksPpt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
panchariyasahil
 
Data Analytics Overview and its applications
Data Analytics Overview and its applicationsData Analytics Overview and its applications
Data Analytics Overview and its applications
JanmejayaMishra7
 
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdfIAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
mcgardenlevi9
 
Induction Program of MTAB online session
Induction Program of MTAB online sessionInduction Program of MTAB online session
Induction Program of MTAB online session
LOHITH886892
 
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptxPRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
JayeshTaneja4
 
Minions Want to eat presentacion muy linda
Minions Want to eat presentacion muy lindaMinions Want to eat presentacion muy linda
Minions Want to eat presentacion muy linda
CarlaAndradesSoler1
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
Andhra Pradesh Micro Irrigation Project”
Andhra Pradesh Micro Irrigation Project”Andhra Pradesh Micro Irrigation Project”
Andhra Pradesh Micro Irrigation Project”
vzmcareers
 
Introcomputerscienceand datascience.pptx
Introcomputerscienceand datascience.pptxIntrocomputerscienceand datascience.pptx
Introcomputerscienceand datascience.pptx
abdulrehmanbscsf22
 
Geometry maths presentation for begginers
Geometry maths presentation for begginersGeometry maths presentation for begginers
Geometry maths presentation for begginers
zrjacob283
 
Call illuminati Agent in uganda+256776963507/0741506136
Call illuminati Agent in uganda+256776963507/0741506136Call illuminati Agent in uganda+256776963507/0741506136
Call illuminati Agent in uganda+256776963507/0741506136
illuminati Agent uganda call+256776963507/0741506136
 
computer organization and assembly language.docx
computer organization and assembly language.docxcomputer organization and assembly language.docx
computer organization and assembly language.docx
alisoftwareengineer1
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
History of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptxHistory of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptx
balongcastrojo
 
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docxMASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
santosh162
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
Calories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptxCalories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptx
TijiLMAHESHWARI
 
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjksPpt. Nikhil.pptxnshwuudgcudisisshvehsjks
Ppt. Nikhil.pptxnshwuudgcudisisshvehsjks
panchariyasahil
 
Data Analytics Overview and its applications
Data Analytics Overview and its applicationsData Analytics Overview and its applications
Data Analytics Overview and its applications
JanmejayaMishra7
 
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdfIAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
mcgardenlevi9
 
Induction Program of MTAB online session
Induction Program of MTAB online sessionInduction Program of MTAB online session
Induction Program of MTAB online session
LOHITH886892
 
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptxPRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
PRE-NATAL GRnnnmnnnnmmOWTH seminar[1].pptx
JayeshTaneja4
 
Minions Want to eat presentacion muy linda
Minions Want to eat presentacion muy lindaMinions Want to eat presentacion muy linda
Minions Want to eat presentacion muy linda
CarlaAndradesSoler1
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
Andhra Pradesh Micro Irrigation Project”
Andhra Pradesh Micro Irrigation Project”Andhra Pradesh Micro Irrigation Project”
Andhra Pradesh Micro Irrigation Project”
vzmcareers
 
Introcomputerscienceand datascience.pptx
Introcomputerscienceand datascience.pptxIntrocomputerscienceand datascience.pptx
Introcomputerscienceand datascience.pptx
abdulrehmanbscsf22
 
Geometry maths presentation for begginers
Geometry maths presentation for begginersGeometry maths presentation for begginers
Geometry maths presentation for begginers
zrjacob283
 
computer organization and assembly language.docx
computer organization and assembly language.docxcomputer organization and assembly language.docx
computer organization and assembly language.docx
alisoftwareengineer1
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
History of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptxHistory of Science and Technologyandits source.pptx
History of Science and Technologyandits source.pptx
balongcastrojo
 
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docxMASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
MASAkkjjkttuyrdquesjhjhjfc44dddtions.docx
santosh162
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
Calories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptxCalories_Prediction_using_Linear_Regression.pptx
Calories_Prediction_using_Linear_Regression.pptx
TijiLMAHESHWARI
 
Ad

Lecture 1 to 3intro to normalization in database

  • 2. Outline Introduction Traditional File Based system File-Based Approach Limitation of File Based system Database Approach Applications of Database System View of Data Data Abstraction Instances and Schemas Data Models Database Languages DML DDL Database Design Design Process The Entity-Relationship Model Normalization Data Storage and Querying Storage Manager The Query Processor Transaction Management Database Architecture Database Users and Administrators
  • 3. Introduction What is Data? Fact and Figures or distinct pieces of information What is a database? Collection of related data. What is a database Management System? Database systems give a set of tools for storing, searching and managing this information What is a database Application? database application is simply a program that interacts with the database at some point in its execution. It is an intermediary between user and DBMS.
  • 4. Traditional File Based System A collection of application programs that perform services for the end-users, such as the production of reports. Each program defines and manages its own data. Conventional file systems are inadequate as database systems, because they fail to support efficient search, efficient modifications to small pieces of data, complex queries, or atomic and independent execution of transactions.
  • 5. File-Based Processing © Pearson Education Limited 1995, 2005
  • 6. Activity Make a group of two people Search on web or from your text book the limitation of the file based system. Give presentation on it using board.
  • 7. Limitation of File Based system 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: Incompatible file formats Programs are written in different languages, and so cannot easily access each other’s files. Integrity problems Integrity constraints (e.g. account balance > 0) become part of program code Hard to add new constraints or change existing ones Fixed Queries/Proliferation of application programs Any new requirement needs a new program.
  • 8. Limitation of File Based 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 Database systems offer solutions to all the above problems
  • 9. Database Management System (DBMS) © Pearson Education Limited 1995, 2005
  • 11. Applications of Database-System Enterprise Information: Sales, Accounting, Human Resource Airline reservation systems: For reservation, scheduling Banking systems: Credit and transaction, Finance Telecommunication: records of calls, monthly bills, communication networks
  • 12. Levels of Abstraction Physical level describes how a record (e.g., customer) is stored. Logical level: describes data stored in database, and the relationships among the data. type customer = record name : string; street : string; city : integer; end; View level: application programs hide details of data types. Views can also hide information (e.g., salary) for security purposes.
  • 15. View of Data • Allows each user to have his or her own view of the database. • A view is essentially some subset of the database. • An architecture for a database system
  • 16. Views - Benefits Reduce complexity Provide a level of security Provide a mechanism to customize the appearance of the database Present a consistent, unchanging picture of the structure of the database, even if the underlying database is changed
  • 17. Instances and Schemas Similar to types and variables in programming languages Schema – the structure view (design) of the database e.g., the database consists of information about a set of customers and accounts and the relationship between them) Analogous to type information of a variable in a program Physical schema: database design at the physical level Logical schema: database design at the logical level Instance – the actual content of the database at a particular point in time Analogous to the value of a variable Physical Data Independence – the ability to modify the physical schema without changing the logical schema Applications depend on the logical schema In general, the interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others.
  • 18. Data Models A collection of tools for describing Data, Data relationships, Data semantics, Data constraints A data model provides a way to describe the design of a database at the physical, logical, and view levels. The data models can be classified into four different categories: Relational model Entity-Relationship data model (mainly for database design) Object-based data models (Object-oriented and Object-relational) Semistructured data model (XML) Other older models: Network model Hierarchical model
  • 19. Entity-Relationship Model Example of schema in the entity-relationship model
  • 20. Relational Model All the data is stored in various tables. Example of tabular data in the relational model Columns Rows
  • 22. Database Languages Database system provides DDL to specify the database schema and DML to express database queries and updates.
  • 23. 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) Data storage and definition language These statements define the implementation details of the database schemas, which are usually hidden from the users. Usually an extension of the data definition language
  • 24. 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
  • 25. 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
  • 26. Database Design The process of designing the general structure of the database: Specification: to characterize fully the data needs of the prospective database users. Conceptual Design: The focus at this point is on describing the data and their relationships Business decision – What attributes should we record in the database? Computer Science decision – What relation schemas should we have and how should the attributes be distributed among the various relation schemas? There are principally two ways to tackle the problem. entity-relationship model Normalization: that takes as input the set of all attributes and generates a set of tables
  • 27. Continue The process of moving from an abstract data model to the implementation of the database proceeds in two final design phases Logical Design: designer maps the high-level conceptual schema onto the implementation data model of the database system that will be used Physical Design: the physical features of the database are specified. These features include the form of file organization and the internal storage structures
  • 28. Design Approaches Need to come up with a methodology to ensure that each of the relations in the database is “good” Two ways of doing so: Entity Relationship Model (Chapter 7) Models an enterprise as a collection of entities and relationships Represented diagrammatically by an entity-relationship diagram: Normalization Theory (Chapter 8) Formalize what designs are bad, and test for them
  • 30. Storage Management Storage manager is a program module that provides the interface between the low- level data stored in the database and the application programs and queries submitted to the system. The storage manager is responsible to the following tasks: Interaction with the OS file manager Efficient storing, retrieving and updating of data Issues: Storage access File organization Indexing and hashing
  • 31. Query Processing The query processor components include: DDL interpreter, which interprets DDL statements and records the definitions in the data dictionary. DML compiler, which translates DML statements in a query language into an evaluation plan consisting of low-level instructions that the query evaluation engine understands. The DML compiler also performs query optimization; that is, it picks the lowest cost evaluation plan from among the alternatives. Query evaluation engine, which executes low-level instructions generated by the DML compiler.
  • 32. Transaction Management What if the system fails? What if more than one user is concurrently updating the same data? A transaction is a collection of operations that performs a single logical function in a database application Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures. Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database.
  • 34. 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
  • 35. 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
  • 36. Database Architecture The architecture of a database systems is greatly influenced by the underlying computer system on which the database is running: Centralized Client-server Parallel (multi-processor) Distributed
  • 37. Application Architectures Two-tier architecture: E.g. client programs using ODBC/JDBC to communicate with a database Three-tier architecture: E.g. web-based applications, and applications built using “middleware”
  • 38. Suggested Reading Chapter 1 of Database System Concepts by Abraham Silberschatz Chapter 1,2,3,4 of Database Systems: A Practical Approach to Design, Implementation, and Management by Thomas Conolly