Lecturer:
M.Zalmai “Rahmani”
rahmani.zalmai@gmail.com
Advanced Database Systems
Database & Database Users
Lecture 01
Azma Institute
Database Department
Database Applications
Banking:
For customer information, accounts, loans and banking transactions.
Universities:
For student information, course registrations, and grades.
Sales:
For customer, product, and purchase information.
Airlines:
For reservations and schedule information.
Database Applications
Credit card transactions:
For purchases on credit cards and generation of monthly statements
“printed record of account activity”.
Human resources:
For information about employees, salaries, payroll taxes and benefits, and
for generation of pay checks “salary”.
Telecommunication:
For keeping records of calls made, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the
communication network.
Database Applications
Finance:
For storing information about sales, and purchases of financial instruments
such as stocks and bonds.
Manufacturing:
For management of supply chain and for tracking production of items in
factories, inventories of items in warehouses/stores, and orders for items.
Databases play a critical role in almost all areas in which
computers are used!
Brainstorming Summary
What is database?
A database is a collection of related data.
By data, we mean known facts that can be recorded and that have implicit
meaning.
Database Properties
Represents some aspect of the real world that is called the miniworld.
Changes to the miniworld are reflected in the database.
Is a logically coherent collection of data with some inherent meaning.
A random assortment of data cannot correctly be referred to as a database.
Is designed, built, and populated with data for a specific purpose.
Size & Complexity of a Database
A database can be of any size and complexity
• Example for a small database:
Personal DB with addresses with only a few hundred records (each with a
simple structure)
• Example for a large database:
Amazon.com: with more than 20 million of books, CDs, eBooks,
magazines, journals and etc. In a DB with the size of 2 terabytes
Database Management Systems
(DBMS)
A Database Management System (DBMS) is a collection of interrelated data
and set of programs to access those data.
• The collection of data, usually referred to as the database, contains
information related to an enterprise.
Is a collection of programs that enables users to create and maintain a
database.
Database Management Systems
(DBMS)
DBMS fulfils(Do) different purposes:
• Defining : Specifying the data types, structures, and constraints for the data
to be stored in the database.
• Constructing : Process of storing the data itself on some storage medium
that is controlled by the DBMS.
• Manipulating : Adding, Updating, Deleting ….
• Sharing databases among various users and applications
(DBMS)
MS Access
MySQL (Open Source)
SQL-Server (Microsoft)
Oracle
PostgreSQL
FoxPro
SQLite
Application Program /
Database System
An application program accesses the database by sending queries or
requests to the DBMS.
• A query (question, inquiry) is the interaction with the database, e.g.
retrieving or manipulating data.
Database System
• The database, the DBMS software, and the application program together
are called a database system.
Overview
Example of a Database System
UNIVERSITY database
• Defining the database: we must specify the structure of the records of each
file by specifying the different types of data elements to be stored in each
record .
• Constructing the database: we store data to represent each student,
course, section, grade report, and prerequisite as a record in the appropriate
file
• Manipulating the database: Querying and updating
Characteristics of the Database
A number of characteristics distinguish the database approach from the
traditional approach of programming with files :
• Self Describing nature of the database
Database system contains not only the database itself but also a complete
definition or description of the database structure and constraints.
Characteristics of the Database
Data Abstraction
• Allows program-data independence and program-operation independence
MultipleViews of the Data
• Some users may not need to be aware of whether the data they refer to is
stored or derived
• One user of the database may be interested only in the transcript of each
student;
• A second user, who is interested only in checking that students have taken all
the prerequisites of each course they register for
Characteristics of the Database
Sharing of Data and MultiuserTransaction Processing
• ConcurrencyControl to manage transactions
A transaction is an executing program or process that includes one or more
database accesses, such as reading or updating of database records
Actors on the scenes
What roles do people take around a database system?
• Database Administrators
• Database Designers
• End Users
• Application Programmers (Software Engineers)
Actors on the scenes
Database Administrators
• When the database is designed and implemented it is handed over to the DB
administrator
• person responsible for the DB during its lifetime
• management of user accounts, hardware resources, backups, etc.
Actors on the scenes
Database Designers
• The database designers conceptually design and implement the DB
• Analyze requirements for the DB
• Gathering of information about the application field
• Conceptual schema. (conceptual = of an idea or concept)
• Choice of DBMS
Actors on the scenes
End Users
• The people who will use the DB when it is finished
• Normally little technical knowledge
• Use the DB
Application Programmers
• Programmers that write programs that use the DB
• Programmers of a graphical user interface (GUI) for the database
Workers behind the scenes
People who are working behind the database scenes are as:
• DBMS system designers and implementers
• Design and implement the DBMS modules and interfaces as a software
package.
Tool developers
• Design and implement tools—the software packages that facilitate database
modelling and design, database system design, and improved performance.
Operators and maintenance personnel
• Responsible for the actual running and maintenance of the hardware and
software environment for the database system.
Advantages of using the DBMS
Controlling redundancy
Providing Storage Structures and SearchTechniques for Efficient Query
Processing
Providing Backup and Recovery
Providing Multiple User Interfaces
Representing Complex Relationships among Data
Enforcing Integrity Constraints
Permitting Inference and Actions Using Rules
DBMS VS. File Systems
Why don’t store on plain files?
Consider part of a savings-bank enterprise that stores information about all
customers and saving accounts.
• We need separate application programs that manipulate the files.
• A program to debit or credit an account
• A program to add a new account
• A program to find the balance of an account
• A program to generate monthly statements
File Systems
Advantages of using file
systems
We would rather use plain files and develop additional software tools, if:
• The database is simple
• The actions on the data are simple
• No multi-user environment
Example: private address book, data can be even “stored” on paper
Disadvantages of using file
systems
Data redundancy and inconsistency:
• Since in File Systems we store all information in different files, so the same
information maybe duplicated in several files.
• Redundancy leads to higher storage and access cost.
• Redundancy also leads to data inconsistency
Disadvantages of using file
systems
Difficulty in accessing data
• What happen if someone asks about list of all customers who live in a special
city “kabul”, Since the original system did not predict this kind of list with
mentioned criteria
• File Systems do not allow needed data to be retrieved in a convenient and
efficient manner.
Data Isolation:
• Because data are scattered in various files, and files maybe in different
formats, writing new application programs to retrieve the needed data is not
that much easy.
Disadvantages of using file
systems
Problems
• Consider a program to transfer 100$ from accountA to account B.
Constrains:
If a system failure or crush occurs during the execution of the transfer.
Possibility:
100$ remove from accountA, but not added to account B.
• It is essential to database consistency that either both the debit and credit
occur, or that neither occur.
Disadvantages of using file
systems
Concurrent access exception
• Uncontrolled multi-user access can have undesirable results!
• Consider bank accountA, has 500$. If two customers at the same time
withdraw (one 50$ and the other 100$) from accountA, the result of the
concurrent executions may leave the account in an incorrect state.
Security Problems
• Data should not be accessible for all users.
• No Mechanism for giving certain privileges to certain users.
• No mechanisms for user authorization and encryption in file-processing
system.
Advantages of database
systems
Fast, complex queries on data are possible:
• Example:
We would like to know the names of all employees who live in Kabul and
have a salary higher than the average salary.
• It is not easy/can take a lot of time to extract this information from a file.
• It is even more difficult/impossible to “link” data that is stored across several
isolated files.
Advantages of database
systems
Redundancy control and consistency control
• Example:
Both, university administration and individual departments store data
about students in isolated files
• Same data is stored several times (=redundancy)
• More storage space necessary
• Difficult to maintain consistency (for example if
Administration updates address of student, but it is not updated in the files
of department)
Advantages of database
systems
Support of multi-user environment
• Uncontrolled multi-user access can have undesirable results!
Example:
if userA and user B read a file at the same time, userA writes data into the
file and stores it, user B writes data and stores it data of userA is
overwritten!
Database Systems provide mechanisms to control multiuser access
(concept of “Transactions”)
Advantages of database
systems
Prevention of data loss
• Power failure, hardware/software failure can result in loss of data
• Database Systems provide more sophisticated recovery components to
backup and restore data than File Systems
Advantages of database
systems
Security Issues
• Often we would like to control which users get access to what parts of the
data (read or even manipulate data)
• Database systems provide mechanisms for user authorization and
encryption
Disadvantages of database
systems
Complex, expensive software and hardware
Skilled professionals and user training necessary
Therefore high start-up costs
Database & Database Users

Database & Database Users

  • 1.
    Lecturer: M.Zalmai “Rahmani” rahmani.zalmai@gmail.com Advanced DatabaseSystems Database & Database Users Lecture 01 Azma Institute Database Department
  • 2.
    Database Applications Banking: For customerinformation, accounts, loans and banking transactions. Universities: For student information, course registrations, and grades. Sales: For customer, product, and purchase information. Airlines: For reservations and schedule information.
  • 3.
    Database Applications Credit cardtransactions: For purchases on credit cards and generation of monthly statements “printed record of account activity”. Human resources: For information about employees, salaries, payroll taxes and benefits, and for generation of pay checks “salary”. Telecommunication: For keeping records of calls made, generating monthly bills, maintaining balances on prepaid calling cards, and storing information about the communication network.
  • 4.
    Database Applications Finance: For storinginformation about sales, and purchases of financial instruments such as stocks and bonds. Manufacturing: For management of supply chain and for tracking production of items in factories, inventories of items in warehouses/stores, and orders for items.
  • 5.
    Databases play acritical role in almost all areas in which computers are used! Brainstorming Summary
  • 6.
    What is database? Adatabase is a collection of related data. By data, we mean known facts that can be recorded and that have implicit meaning.
  • 7.
    Database Properties Represents someaspect of the real world that is called the miniworld. Changes to the miniworld are reflected in the database. Is a logically coherent collection of data with some inherent meaning. A random assortment of data cannot correctly be referred to as a database. Is designed, built, and populated with data for a specific purpose.
  • 8.
    Size & Complexityof a Database A database can be of any size and complexity • Example for a small database: Personal DB with addresses with only a few hundred records (each with a simple structure) • Example for a large database: Amazon.com: with more than 20 million of books, CDs, eBooks, magazines, journals and etc. In a DB with the size of 2 terabytes
  • 9.
    Database Management Systems (DBMS) ADatabase Management System (DBMS) is a collection of interrelated data and set of programs to access those data. • The collection of data, usually referred to as the database, contains information related to an enterprise. Is a collection of programs that enables users to create and maintain a database.
  • 10.
    Database Management Systems (DBMS) DBMSfulfils(Do) different purposes: • Defining : Specifying the data types, structures, and constraints for the data to be stored in the database. • Constructing : Process of storing the data itself on some storage medium that is controlled by the DBMS. • Manipulating : Adding, Updating, Deleting …. • Sharing databases among various users and applications
  • 11.
    (DBMS) MS Access MySQL (OpenSource) SQL-Server (Microsoft) Oracle PostgreSQL FoxPro SQLite
  • 12.
    Application Program / DatabaseSystem An application program accesses the database by sending queries or requests to the DBMS. • A query (question, inquiry) is the interaction with the database, e.g. retrieving or manipulating data. Database System • The database, the DBMS software, and the application program together are called a database system.
  • 13.
  • 14.
    Example of aDatabase System UNIVERSITY database • Defining the database: we must specify the structure of the records of each file by specifying the different types of data elements to be stored in each record . • Constructing the database: we store data to represent each student, course, section, grade report, and prerequisite as a record in the appropriate file • Manipulating the database: Querying and updating
  • 15.
    Characteristics of theDatabase A number of characteristics distinguish the database approach from the traditional approach of programming with files : • Self Describing nature of the database Database system contains not only the database itself but also a complete definition or description of the database structure and constraints.
  • 16.
    Characteristics of theDatabase Data Abstraction • Allows program-data independence and program-operation independence MultipleViews of the Data • Some users may not need to be aware of whether the data they refer to is stored or derived • One user of the database may be interested only in the transcript of each student; • A second user, who is interested only in checking that students have taken all the prerequisites of each course they register for
  • 17.
    Characteristics of theDatabase Sharing of Data and MultiuserTransaction Processing • ConcurrencyControl to manage transactions A transaction is an executing program or process that includes one or more database accesses, such as reading or updating of database records
  • 18.
    Actors on thescenes What roles do people take around a database system? • Database Administrators • Database Designers • End Users • Application Programmers (Software Engineers)
  • 19.
    Actors on thescenes Database Administrators • When the database is designed and implemented it is handed over to the DB administrator • person responsible for the DB during its lifetime • management of user accounts, hardware resources, backups, etc.
  • 20.
    Actors on thescenes Database Designers • The database designers conceptually design and implement the DB • Analyze requirements for the DB • Gathering of information about the application field • Conceptual schema. (conceptual = of an idea or concept) • Choice of DBMS
  • 21.
    Actors on thescenes End Users • The people who will use the DB when it is finished • Normally little technical knowledge • Use the DB Application Programmers • Programmers that write programs that use the DB • Programmers of a graphical user interface (GUI) for the database
  • 22.
    Workers behind thescenes People who are working behind the database scenes are as: • DBMS system designers and implementers • Design and implement the DBMS modules and interfaces as a software package. Tool developers • Design and implement tools—the software packages that facilitate database modelling and design, database system design, and improved performance. Operators and maintenance personnel • Responsible for the actual running and maintenance of the hardware and software environment for the database system.
  • 23.
    Advantages of usingthe DBMS Controlling redundancy Providing Storage Structures and SearchTechniques for Efficient Query Processing Providing Backup and Recovery Providing Multiple User Interfaces Representing Complex Relationships among Data Enforcing Integrity Constraints Permitting Inference and Actions Using Rules
  • 24.
  • 25.
    Why don’t storeon plain files? Consider part of a savings-bank enterprise that stores information about all customers and saving accounts. • We need separate application programs that manipulate the files. • A program to debit or credit an account • A program to add a new account • A program to find the balance of an account • A program to generate monthly statements
  • 26.
  • 27.
    Advantages of usingfile systems We would rather use plain files and develop additional software tools, if: • The database is simple • The actions on the data are simple • No multi-user environment Example: private address book, data can be even “stored” on paper
  • 28.
    Disadvantages of usingfile systems Data redundancy and inconsistency: • Since in File Systems we store all information in different files, so the same information maybe duplicated in several files. • Redundancy leads to higher storage and access cost. • Redundancy also leads to data inconsistency
  • 29.
    Disadvantages of usingfile systems Difficulty in accessing data • What happen if someone asks about list of all customers who live in a special city “kabul”, Since the original system did not predict this kind of list with mentioned criteria • File Systems do not allow needed data to be retrieved in a convenient and efficient manner. Data Isolation: • Because data are scattered in various files, and files maybe in different formats, writing new application programs to retrieve the needed data is not that much easy.
  • 30.
    Disadvantages of usingfile systems Problems • Consider a program to transfer 100$ from accountA to account B. Constrains: If a system failure or crush occurs during the execution of the transfer. Possibility: 100$ remove from accountA, but not added to account B. • It is essential to database consistency that either both the debit and credit occur, or that neither occur.
  • 31.
    Disadvantages of usingfile systems Concurrent access exception • Uncontrolled multi-user access can have undesirable results! • Consider bank accountA, has 500$. If two customers at the same time withdraw (one 50$ and the other 100$) from accountA, the result of the concurrent executions may leave the account in an incorrect state. Security Problems • Data should not be accessible for all users. • No Mechanism for giving certain privileges to certain users. • No mechanisms for user authorization and encryption in file-processing system.
  • 32.
    Advantages of database systems Fast,complex queries on data are possible: • Example: We would like to know the names of all employees who live in Kabul and have a salary higher than the average salary. • It is not easy/can take a lot of time to extract this information from a file. • It is even more difficult/impossible to “link” data that is stored across several isolated files.
  • 33.
    Advantages of database systems Redundancycontrol and consistency control • Example: Both, university administration and individual departments store data about students in isolated files • Same data is stored several times (=redundancy) • More storage space necessary • Difficult to maintain consistency (for example if Administration updates address of student, but it is not updated in the files of department)
  • 34.
    Advantages of database systems Supportof multi-user environment • Uncontrolled multi-user access can have undesirable results! Example: if userA and user B read a file at the same time, userA writes data into the file and stores it, user B writes data and stores it data of userA is overwritten! Database Systems provide mechanisms to control multiuser access (concept of “Transactions”)
  • 35.
    Advantages of database systems Preventionof data loss • Power failure, hardware/software failure can result in loss of data • Database Systems provide more sophisticated recovery components to backup and restore data than File Systems
  • 36.
    Advantages of database systems SecurityIssues • Often we would like to control which users get access to what parts of the data (read or even manipulate data) • Database systems provide mechanisms for user authorization and encryption
  • 37.
    Disadvantages of database systems Complex,expensive software and hardware Skilled professionals and user training necessary Therefore high start-up costs