Introduction To Database
Introduction To Database
1.2
Database Systems
1.3
Database Applications Examples
• Enterprise Information
• Sales: customers, products, purchases
• Accounting: payments, receipts, assets
• Human Resources: Information about employees, salaries, payroll
taxes.
• Manufacturing: management of production, inventory, orders, supply
chain.
• Banking and finance
• customer information, accounts, loans, and banking transactions.
• Credit card transactions
• Finance: sales and purchases of financial instruments (e.g., stocks
and bonds; storing real-time market data
• Universities: registration, grades
1.4
Database Applications Examples (Cont.)
1.5
Purpose of Database Systems
In the early days, database applications were built directly on top of file
systems, which leads to:
• Data redundancy and inconsistency:
data is stored in multiple file formats resulting in 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 “buried”
in program code rather than being stated explicitly
Hard to add new constraints or change existing ones
1.6
Purpose of Database Systems
In the early days, database applications were built directly on top of file
systems, which leads to:
• _______________:
data is stored in multiple file formats resulting in duplication of
information in different files
• ________________:
Need to write a new program to carry out each new task
• ________________:
Multiple files and formats
• ________________:
Integrity constraints (e.g., account balance > 0) become “buried” in
program code rather than being stated explicitly
Hard to add new constraints or change existing ones
1.7
Purpose of Database Systems (Cont.)
• Atomicity of updates
• Failures may leave database in an inconsistent state with partial
updates carried out
• Example: Transfer of funds from one account to another should either
complete or not happen at all
• Concurrent access by multiple users
• Concurrent access needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
• Ex: Two people reading a balance (say 100) and updating it by
withdrawing money (say 50 each) at the same time
• Security problems
• Hard to provide user access to some, but not all, data
1.8
Purpose of Database Systems (Cont.)
• __________of updates
• Failures may leave database in an inconsistent state with partial
updates carried out
• Example: Transfer of funds from one account to another should either
complete or not happen at all
• ___________ access by multiple users
• _________ access needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
• Ex: Two people reading a balance (say 100) and updating it by
withdrawing money (say 50 each) at the same time
• ___________ problems
• Hard to provide user access to some, but not all, data
1.9
University Database Example
• In this text we will be using a university database to illustrate all the
concepts
• Data consists of information about:
• Students
• Instructors
• Classes
• Application program examples:
• Add new students, instructors, and courses
• Register students for courses, and generate class rosters
• Assign grades to students, compute grade point averages (GPA) and
generate transcripts
1.10
1.11
View of Data
• A database system is a collection of interrelated _______and a set of
________ that allow users to access and modify these data.
• A major purpose of a database system is to provide users with an
abstract view of the data.
• Data models
• A collection of conceptual tools for describing data, data
relationships, and consistency constraints.
• Data abstraction
• Hide the complexity of data structures to represent data in the
database from users through several levels of data abstraction.
1.12
View of Data
• A database system is a collection of interrelated data and a set of
__________ that allow users to access and modify these data.
• A major purpose of a database system is to provide users with an
abstract view of the data.
• Data models
• A collection of conceptual tools for describing data, data
relationships, and consistency constraints.
• Data abstraction
• Hide the complexity of data structures to represent data in the
database from users through several levels of data abstraction.
1.13
View of Data
• A database system is a collection of interrelated data and a set of
programs that allow users to access and modify these data.
• A major purpose of a database system is to provide users with an
abstract view of the data.
• Data models
• A collection of conceptual tools for describing data, data
relationships, and consistency constraints.
• Data abstraction
• Hide the complexity of data structures to represent data in the
database from users through several levels of data abstraction.
1.14
Data Models
• A collection of tools for describing
• Data
• Data ________
• Data ________
• Relational model
• Object-based data models
• Other older models:
• Network model
• Hierarchical model
1.15
Data Models
• A collection of tools for describing
• Data
• Data relationships
• Data constraints
• Relational model
• Object-based data models
• Other older models:
• Network model
• Hierarchical model
1.16
1.17
1.18
1.19
1.20
1.21
1.22
1.23
Relational Model
• All the data is stored in various ________.
• Example of tabular data in the relational model.
Columns
Rows
Ted Codd
Turing Award 1981
1.24
Relational Model
• All the data is stored in various tables.
• Example of tabular data in the relational model.
Columns
Rows
Ted Codd
Turing Award 1981
1.25
ACM A.M. Turing Award
1.26
Ted Codd
Turing Award 1981
Ted Codd (19 August 1923 – 18 April 2003) was an English computer scientist who, while
working for IBM, invented the relational model for database management, the theoretical basis
for relational databases and relational database management systems. He made other valuable
contributions to computer science, but the relational model, a very influential general theory of
data management, remains his most mentioned, analyzed and celebrated achievement
https://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf
1.27
Levels of Abstraction
1.28
Levels of Abstraction
1.29
Levels of Abstraction
1.30
Levels of Abstraction
1.31
Instances and Schemas
1.32
Data Independence
1.33
Data Definition Language (DDL)
1.34
Data Definition Language (DDL)
• Specification notation for defining the database schema
Example: create table instructor (
ID char(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2))
• DDL compiler generates a set of table templates stored in a data dictionary
• Data dictionary contains metadata (i.e., data about data)
Key Words:
• CREATE DATABASE
• ALTER DATABASE
• CREATE TABLE
• ALTER TABLE
• DROP TABLE
• CREATE INDEX
• DROP INDEX
1.35
Data Manipulation Language (DML)
1.36
SQL Query Language
1.37
SQL Query Language
Key Words:
• SELECT: retrieve data from the database
• INSERT: insert data into a table
• UPDATE: update existing data within a table
• DELETE: deletes records from a table,
space for the records remain
1.38
Data Control Language (DCL)
Key Words:
1.39
Transaction Control Language (TCL)
Key Words:
1.41
History of Database Systems
1.42
History of Database Systems (Cont.)
• 1980s:
• Research relational prototypes evolve into commercial systems
• SQL becomes industrial standard
• Parallel and distributed database systems
• Wisconsin, IBM, Teradata
• Object-oriented database systems
• 1990s:
• Large decision support and data-mining applications
• Data warehouses
• Emergence of Web commerce
1.43
History of Database Systems (Cont.)
• 2000s
• Big data storage systems
• Google BigTable, Yahoo PNuts, Amazon,
• “NoSQL” systems.
• Big data analysis: beyond SQL
• Map reduce
• 2010s
• SQL reloaded
• SQL front end to Map Reduce systems
• Massively parallel database systems
• Multi-core main-memory databases
1.44
Database Engine
• A database system is partitioned into modules that deal with each of
the responsibilities of the overall system.
• The functional components of a database system can be divided into
• The storage manager,
• The query processor component,
• The transaction management component.
1.45
Storage Manager
1.46
Storage Manager (Cont.)
1.47
Query Processor
1.48
Query Processor
1.49
Query Processor
1.50
Transaction Management
1.51
Database Engine
• A database system is partitioned into modules that deal with each of
the responsibilities of the overall system.
• The functional components of a database system can be divided into
• __________________________
• __________________________
• __________________________
1.52
Database Engine
• A database system is partitioned into modules that deal with each of
the responsibilities of the overall system.
• The functional components of a database system can be divided into
• The storage manager,
• ___________________________.
• ___________________________.
1.53
Database Engine
• A database system is partitioned into modules that deal with each of
the responsibilities of the overall system.
• The functional components of a database system can be divided into
• The storage manager,
• The query processor component,
• ___________________________.
1.54
Database Engine
• A database system is partitioned into modules that deal with each of
the responsibilities of the overall system.
• The functional components of a database system can be divided into
• The storage manager,
• The query processor component,
• The transaction management component.
1.55
Database Applications
Database applications are usually partitioned into two or three
parts
1.56
Database Applications
Database applications are usually partitioned into two or three
parts
1.57
Two-tier and three-tier architectures
1.58
Transactions
• _______________________
• _______________________
• _______________________
• _______________________
1.59
Transactions
-Atomicity
-Consistency
-Isolation
-Durability
1.60