0% found this document useful (0 votes)
129 views

Chapter1-Introduction To DBMS

The document discusses a course on database management systems (DBMS). It defines DBMS and explains its objectives of efficient data management, storage and retrieval of information, and ensuring data safety. It also discusses database system applications, the purpose of databases including limitations of file systems, views of data in databases, different data models including relational and entity-relationship models, database languages including data definition and manipulation languages, and database users and administrators.

Uploaded by

screa3m
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views

Chapter1-Introduction To DBMS

The document discusses a course on database management systems (DBMS). It defines DBMS and explains its objectives of efficient data management, storage and retrieval of information, and ensuring data safety. It also discusses database system applications, the purpose of databases including limitations of file systems, views of data in databases, different data models including relational and entity-relationship models, database languages including data definition and manipulation languages, and database users and administrators.

Uploaded by

screa3m
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 37

‫جامعة اإلمام محمد بن سعود اإلسالمية‬

‫كلية علوم الحاسب و المعلومات‬

Course 1
Introduction to DBMS

Dr. Mohsen Rouached

Computer Science (CS 420)


Database Management Systems (DBMS)
Table of contents
 Definition of DBMS
 Objective of DBMS
 Database System Applications
 Purpose of Databases
 Limitation of the file system based databases
 View of Data in Databases
 Data Models
 Database Languages
 Database Users and Administrator
Definition of DBMS
 A database management system (DBMS) is
 a collection of interrelated data (database)
and
 a set of programs to access those data.
Objective of DBMS
 Provide a way for efficient data management
 storage and retrieval of the information
 Manage large bodies of information
 Defining structures for the storage of information
 Providing the mechanisms for the manipulation of the
information
 Ensure the safety of the information stored
 Avoid abnormal results when sharing the DB
among several users
Database System Applications
 Banking: all transactions
 Airlines: reservations, schedules
 Universities: registration, grades, student information
 Sales: customers, products, purchases
 Manufacturing: production, inventory, orders, supply
chain
 Human resources: employee records, salaries, tax
deductions
 Telecommunications: keeping record of calls made,
generating monthly bills
Purpose of Database Systems
Limitations of File Systems (1/3)

 In the early days, database applications were built on top


of file systems
 Data is stored in separate files
 Data is manipulated by a set of application programs
 As time goes by, the number of files and application
programs increases
 increasing complexity of database application management
Purpose of Database Systems
Limitations of File Systems (2/3)
 Drawbacks of using file systems to store data
 Data redundancy and inconsistency
 Redundancy: duplication of information in different files
 Inconsistency: the various copies of the same data may be different
 Difficulty in accessing data
 Need to write a new program to carry out each new task
 Data isolation — multiple files and formats
 Because data are scattered in various files, and files may be in different
formats, writing the appropriate information to retrieve the appropriate data is
difficult
 Integrity problems
 Data values stored in the database must satisfy certain types of consistency
constraints
 Integrity constraints (e.g. account balance > 0) become part of program code
 Those constraints are forced by the database system developer
 Hard to add new constraints or change existing ones
Purpose of Database Systems
Limitations of File Systems (3/3)
 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
 Not every user of the database should be able to access all the data

Database systems offer solutions to all previous problems


View of Data in a Database
 Recall that
a database management system (DBMS) is a collection
of interrelated data and a set of programs to access and
modify those data.
 A major purpose of a database system is to provide users
with an abstract view of data
 The system hides certain details of how the data are

stored and maintained


View of Data in a Database
The Need for Data Abstraction

 The objective of data abstraction is to


simplify the interaction with the database
from the user perspective
 Most of database users are not computer
trained
 However, more complexity from the design
perspective
 Complex data structure to represent data
View of Data in a Database
Data Abstraction Levels

 Physical Level: describes how the data is


actually stored
 Describes low level data structures
 Logical Level: describes what data are
stored in the database and what
relationships exist between data
 View Level: describes only part of the
entire database
View of Data in a Database
Data Abstraction Levels

 Physical Level: describes how


the data is actually stored
 Describes low level data
structures
 Logical Level: describes what
data are stored in the
database and what What to store
relationships exist between
data
 View Level: describes only How to store
part of the entire database
View of Data in a Database
Analogy with data types in programming

 Consider high level programming type customer = record


 Physical Level: block of consecutive name : string;
storage locations (e.g. bytes) street : string;
 The compiler hides this level of details city : integer;
from programmers end;
 Logical Level: each record is described
by a type definition
 Programmers work at this level of
abstraction
 Similar to database administrator
 View Level: computer users only see a
set of applications without details on
data types
 Similar to users of database
 e.g. some database users are not
allowed to see the salary of workers for
security reasons.
Data Models
Definition

 The Data Model: a collection of conceptual


tools for describing
 Data
 Data relationship
 Data semantics
 Consistency constraints
 A data model provide a way to describe the
design of a database at the physical, logical
and view level
Data Models
Definition

 Data models can be classified in four


categories
1. Relational model
2. The Entity-Relation model
3. Object-based Data model
4. Semi Structured Data model
 Other models: network model,
hierarchical model
Data Models
The Relational Model

 The Relational Model: uses a collection of tables


to represent both data and the relationship among
those data.
 Each table has multiple column and each column has a
unique name (Attribute)
 The most widely used as a data model for databases
 Vast majority of current database systems are based on
the relational model
Data Models
The Relational Model
Sample of a Relational database

Attributes
Data Models
The Entity-Relationship Model

 The Entity-Relationship (E-R) Model: it is based on the


perception of a real world that consists of a collection
basic objects called entities and of relationships among
those objects.
 An entity is a “thing” or “object” from the real world that is
distinguishable from other objects
 e.g. customers, accounts, bank branch
 A relationship is an association among several entities
 e.g. the account Ac1234 is held by the customer Mr. Abdullah
 This model is also widely used in database design
Data Models
The Entity-Relationship Model

 The Entity-Relationship (E-R) Model: it is based


on the perception of a real world that consists of a
collection basic objects called entities and of
relationships among those

Attributes • Rectangles: represent the set of entities


• Ellipses: represent the attributes of an
entity
• Diamonds: represent the set of
relationships among a member from each
of several entity sets
entity entity • Lines: link the attributes to entity sets
and entity sets to relationships
Relationship
Data Language
Definition
 A database system provides
 a data definition language to specify the
database schema
 a data manipulation language to express
database queries and update
 In practice, both languages are not separate
 e.g. SQL (Structured Query Language)
Data Definition Language
(DDL)
 Data Definition Language: specifies the 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)
 The schema of a table is an example of metadata
 Data storage and definition language
 Usually an extension of the data definition language
 Language in which the storage structure and access methods used by the
database system are specified
 Hidden from the user of the database
Data Manipulation Language (DML)
 Language for accessing and manipulating the
data organized by the appropriate data model
 DML also known as query language
 Data manipulation is:
 The retrieval of information stored in the database
 The insertion of new information into the database
 The deletion of the information from the database
 The modification (update) of the information from the
database
Data Manipulation Language (DML)
 Two classes of languages
 Procedural – user specifies what data is required and how to get
those data
 Declarative (Nonprocedural) – user specifies what data is
required without specifying how to get those data (e.g. SQL)
 Easy to learn and to use
 The database system has to figure out an efficient means of
accessing the data
 SQL is the most widely used query language
 A Query is a statement requesting the retrieval of the
information
SQL: Some Examples
 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 (API) (e.g. ODBC/JDBC) which allow SQL
queries to be sent to a database
Database Users
 People who work with a database can be
categorized as
 database users or
 database administrators
 Users are differentiated by the way they expect
to interact with the system
Database Users
 Four types of database users
 Naïve users: invoke one of the permanent application programs that have been
written previously
 E.g. Bank cashier, people accessing a database over the web
 The typical user interface for naïve user is a form interface where the user just fill in the
appropriate fields of the form
 Application programmers: computer professional that write application
programs
 Choose a tool from many tools to build a user interface to the database
 Interact with the system through DML calls
 Sophisticated users: Interact with the system without writing programs
 Form their requests using a database query language (e.g. Analysts)
 Specialized users: write specialized database applications that do not fit into
the traditional data processing framework
 E.g. computer-aided design systems, expert systems, environement modeling systems
Database Administrators
 The Database Administrator (DBA) Coordinates all the activities of the
database system
 The DBA has a good understanding of the enterprise’s information
resources and needs
 The DBA has central control over the system
 Database administrator's duties include:
 Schema definition, specifying integrity constraints
 Storage structure and access method definition
 Schema and physical organization modification
 Granting user authority to access the database
 Acting as liaison with users
 Monitoring performance and responding to changes in requirements
 Routine maintenance (DB backup, Ensuring free space for the DB, etc …)
Transaction Management
 A transaction is a collection of operations that performs s single logical
function in a database application
 E.g. Money transfer from an account to another
 Each transaction must satisfy the following properties:
 Atomicity: all-or-none, which means that the transaction successfully
completes if and only if all the tasks of the transactions are successfully
completed
 E.g. in case of a money transfer, the transaction is valid if both debit and credit
operations occur.
 Consistency: the final state of the system must be correct and compatible
with the previous status before the transaction is made.
 E.g. after a credit transaction, the balance must be updated accordingly to the
operation
 Isolation.
solation It ensures that concurrently executing transactions are isolated
from one another, so that each transaction has the impression that no other
transaction is executing concurrently with it.
 That is, for every pair of transactions Ti and Tj, it appears to Ti that either Tj, finished execution before Ti started, or
Tj started execution after Ti finished.
 Durability: the value in the database must persist, even in case of a system failure.
Database System Structure
 A database system has several sub-systems
 Transaction Manager
 Responsible for ensuring that the database remains in a
consistent (correct) state despite systems failure.
 Ensures that concurrent transaction execution proceed without
conflicting
 Query Processor
 Compile and executes DDL and DML statements
 Storage Manager
 Provides the interface between the low-level data stored in the
database and the application programs and queries submitted
to the system
Application Architectures
 (Most of) Database systems are accessed
remotely through a network
 The Client/Server Model
 Client machines, on which remote database users work
 Server machines, on which the database system runs

Client machines
Network Database

Server machines
Application Architectures
 Two-Tiered Architecture User User
 The application is partitioned into
a component that resides at the Application client
client machine application
 It remotely invokes the database Network Network
server machine through query
languages statements Application server
 E.g. using ODBC, JDBC for
interaction between the client and Database systems Database systems
the server
 Three-Tiered Architecture Two-Tiered Architecture Three-Tiered Architecture
 The client machine acts as a
front-end and does not contain
any direct database calls
 The client machine
communication with the server
application through an interface
of forms (not direct queries)
 The server application
communicate with a database
system to access data
Instances and Schemas
 Instance of a database
 The collection of information stored in the database at a
particular moment is called an instance.
 Schema of database
 The overall design of the database is called schema.
 Physical Schema
 Describes the data design at the physical level
 Logical Schema
 Describes the data design at the logical level
Review Terms
 Database management  Data models ((E-R), Relational)
system (DBMS)  Database languages (DDL, DML)
 File Systems  Data Dictionary
 Metadata
 Data inconsistency
 Application program interface
 Consistency constraints  Database administrator
 Data views/ data  Transactions
abstraction  Concurrency
 Database instance  Client and servers machines
Exercises
 Q.1 List four significant differences
between files systems and a DBMS
Exercises
 Q.2 What are the steps that you would take in setting up
a database for a particular enterprise?
 R2.
 Collecting the required information that must be stored in the
database
 Define the structure of the schema of a database, which defines
the logical and physical structure of the data
 Define the method for manipulating the database
 Establish the relation between data
 Granting authorization for data access for the case of multi-user
database systems
 Creating different views of the database for different users of the
database
Exercises
 Q.3 What is the purpose of having a
DBMS?
 R3. the primary goal of a DBMS is to
provide an environment that is both
convenient and efficient for people to
use in retrieving and storing
information
Exercises
 Q.4 Define a transaction. Explain the
meaning of atomicity and illustrate it
on example.
 R4. A transaction is a collection of
operations that performs s single logical
function in a database application

You might also like