Unit - I Introduction To Database Concepts
Unit - I Introduction To Database Concepts
Unit - I Introduction To Database Concepts
Introduction to Database
concepts
Agenda
• Database System
• Overview of Files Systems
• Database System Vs File Systems
• View of Data
• Data Models
• Database Languages
• Database Users and Administrator
• Transaction Management
• Database Architectures
Database System
• Data:
• Known facts that can be recorded and have an implicit meaning. For example, student grades and transcripts at a
university.
• Database:
• A collection of related data.
• Database Management System (DBMS):
• It is a collection of interrelated data & set of programs to access those data.
• Database System:
• DBS = DB + DBMS
• Database System Applications:
Simplified Database System environment
Example of a simple Database
DBMS Functions
• The DBMS performs the following five primary functions:
1. Define, create and organize a database: The DBMS establishes the logical relationships among
different data elements in a database.
2. Input data: It performs the function of entering the data into the database through an input device
with the help of the user.
3. Process data: It performs of manipulation and processing of the data stored in the database.
4. Maintain data integrity and security: It allows limited access of the database to authorized users
to maintain data integrity and security.
5. Query database: It provides information to the decision makers that they need to make important
decisions. The information is provided by querying the database using SQL.
Traditional File Systems
program 1
File 1
data description 1
program 2
data description 2 File 2
program 3
data description 3 File 3
Database Processing
Application
program 1
(with data
semantics)
DBMS
description
Application
program 2 manipulation
(with data database
semantics) control
Application
program 3
(with data
semantics)
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
Drawbacks of using file systems to store data
• 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
View of Data
• Data Abstraction
• Data Models
Data Abstraction
• Physical Level: describes how the data are actually stored.
• Logical Level: describes what data are stored in database, and the relationships among the data.
• View Level: At this level, several views of the database are defined, and a database user sees
some or all of the views. Application programs hide details of data types. Views can also hide
information (e.g., salary) for security purposes.
attribute
entity relationship
Relational Model
• Relational Model includes: Relations, Tuples, Attributes, keys and foreign keys.
• Relation: A two dimensional table make up of tuples (This is a simple definition that we will
define more rigorously in a later chapter).
• Tuple: A row of data in a relation made up of one or more attributes.
• Attribute: A characteristic of the relation contained in a tuple.
Relational Model
A Sample Relational Database
Query
Data Definition Language (DDL)
• Specification notation for defining the database schema
• E.g.
create table account (
account-number varchar(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 Example
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 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
Transaction Management
• 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 Architectures
Two-tier architecture: E.g. client programs using ODBC (Open Database Connectivity API)/JDBC
(Java Database Connectivity API) to communicate with a database
Three-tier architecture: E.g. web-based applications, and applications built using “middleware”
THANK YOU