10/11/12
1
Introduc.on to Databases
Dr. Jeff Pi9ges ITEC 110
Objec.ve
• Provide an overview of database systems
• What is a database?
• Why are databases important?
• What careers are available in the Database field?
• How do I learn more about databases?
2
3
What is a Database?
A collection of persistent data that can be shared
and interrelated
Mannino, Database Design, Application Development, & Administration, 3rd Edition
4
What is a Mission Critical System or Application?
A system or application that must be operational
for a company to function.
5
Examples of Mission Critical Systems
• Email • Point of Sale • Order Processing • Warehouse Management Systems • Financial Systems
6
Mission Critical Business system that does not require a database
10/11/12
2
7
DBMS: Database Container
DBMS
Database
Database Database
8
Oracle Corporation
9"
Why Databases? "
10
In the Beginning…
Customer Program 1
11
Program-Data Dependence
DATA DIVISION. FILE SECTION. FD EMP-FILE LABEL RECORDS ARE OMITTED. 01 EMP-RECORD. 05 EMP-NUMBER PIC 9(4). 05 EMP-LASTNAME PIC X(11). 05 EMP-FIRSTNAME PIC X(11). 05 EMP-SEX PIC X(1). 05 EMP-DEPTID PIC X(4). 05 EMP-SALARY PIC 9(8).
12
File System Model
Cust
Inv
Sales
Program 1
Program 2
Program 4
Program 3
Program 5
10/11/12
3
13
Problems with File System Model
• Changes to file structure or file location effect many programs causing high maintenance costs.
• Data in various and sometimes proprietary data formats. • File Indexes were easily corrupted if not open during data entry,
updates, or deletes. • All Data validation was completely dependent on all application
programs. • All Data security was completely dependent on all application
programs. • Efficient Multi-application / multi-user access to the same file(s)
required strict adherence to agreed upon locking strategies. • Integrated backup and recovery of hundreds of data files is
difficult to control. • Tendency for redundant data to enter various data files.
14
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
Changes to file structure or file location are transparent to application programs. Maintenance costs drop dramatically.
15
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
All data is available through a standard SQL interface and related, industry standard query and reporting tools.
Q & R tools
16
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
All Data validation rules are defined within the DBMS and enforced independently of application program logic.
Con
stra
ints
17
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
Primary responsibility for Data security is now handled by the DBMS providing user based security down to the attribute level.
Users
Grants
18
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
All aspects of multi-user access are handled by the DBMS.
• Locks • Rollbacks • Commits • Transactions
10/11/12
4
19
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
A comprehensive, integrated solution to backup and recovery is provided.
Backup R
ecov
ery
Log Files
Recovery
20
The Solution: DBMS
File 1
File X
Program 1
Program 2
Program 4
Program 3
Program 5
Cust
Sales
Inv
• •
•
DBMS
SQL
A single normalized conceptual model of all data managed by a database administrator (DBA) eliminating redundant and therefore inconsistent data.
Schema
DBA
21
Relational Model
• Relational model is based on tables with rows and columns – Intuitive
• RDBMS is based on extensive theory – Relational Algebra
• Commercial database vendors have implemented a subset of the relational model, often with proprietary extensions
22
Relations and Tuples
EMPID LNAME FNAME DEPT PHONE SALARY
23 Jones Mark ITR 555-1087 45000
25 Smith Sara FINC 555-2222 49000
26 Billings David ACTG 555-4356 42000
31 Dance Ivanna ACTG 444-4887 60000
32 Jones Mary ITR 555-8745 70000
35 Barker Bob ACTG 555-6565 44000
36 Woods Robin ITR 555-9812 90000
37 Jones Mary FINC 555-1234 56000
Employees Table SEX
M
F
M
F
F
M
M
F
Challenges
• Databases are conceptually simple • Databases and Opera.ng Systems are large, mul.-‐user systems that face nearly every major challenge of compu.ng systems
• Many students report that databases are far more interes.ng and challenging than expected
23
Database Jobs
1. Database Developer
2. Database Administrator (DBA)
3. Data / Business Analyst
24
10/11/12
5
Database Developer
• Develop informa.on systems and database applica.ons
• Database engineers work exclusively within the database
• SoYware engineers may design and develop end-‐to-‐end systems
25
Concentra.ons and Cer.fica.ons
• Database
• SoYware Engineering
• Web Development
• Security Cer.ficate
26
Database Development
• Query the database using SQL • Data Modeling • Design and develop physical database objects • Design transac.ons • Develop stored procedures and triggers
27
SQL
• SQL: Structured Query Language • Specify data to be retrieved from the database
28
SELECT name, gpa FROM Students WHERE rank = ‘SR’ AND major = ‘ITEC’ ORDER BY gpa DESC
Find a Friend on Facebook
29
First
City
Last School
State
SELECT first, last, city, state, school FROM Users WHERE first = ? AND last = ? AND school = ? AND city = ? AND state = ?;
Data Modeling
• Conceptual representa.on of how data is organized in the database
• En.ty Rela.onship Diagrams are similar to object-‐oriented data models
• An en.ty usually represents a person, place, or thing
30
10/11/12
6
31
Application Schema
A standard Oracle application typically starts with 250 - 500 pre-defined tables
Views
• Database tables are created to store data efficiently and effec.vely – NOT user friendly
• Views are created on top of the tables • Views increase usability by simplifying the schema and crea.ng objects that are meaningful to business users
• Views enforce security by restric.ng access to rows and columns
32
33
Three Schema Architecture
External Level
View 1 View n View 2
Logical Level
Conceptual Schema
Physical Level
Internal Schema
Database Administrator (DBA)
• Install and maintain database systems
• Design and implement database security
• Manage user accounts and permissions
• Backup and recover data • Tune and op.mize performance
34
Concentra.ons and Cer.ficates
• Database • Security Cer.ficate
35
Physical Design
• Database developers and analysts work with the conceptual database
• Database Administrators work with the physical database – Data files – Disk storage – Servers and other hardware
36
10/11/12
7
24/7 Up.me
• Enterprise database systems are usually available 24 hours a day, 7 days a week
• This requires fault tolerant systems
– Redundant components
– Redundant data storage
• The DBA must recover from failure
37
Data Analyst
• Analyze data to help people and organiza.ons make be9er decisions
38
Concentra.ons and Cer.ficates
• Database • Computer Science • Informa.on Systems
39 40
Going Global
The following slides were presented
by Paul Grossman at the
February 2009 NCTC Technology & Toast
ExportVirginia.org
41
THE REAL WORLD
POPULATION
Source: www.world mapper.org 42
THE REAL WORLD
CONTAINER PORTS
Source: www.world mapper.org
10/11/12
8
43
THE REAL WORLD
HIGH TECH EXPORTS1990
Source: www.world mapper.org 44
THE REAL WORLD
HIGH TECH EXPORTS 2002
Source: www.world mapper.org
45
THE REAL WORLD
HIGH TECH EXPORTS 2002
Source: www.world mapper.org 46
What If
• You could view your business like these maps of the world?
• You could identify trends and compare
your business to your competitors with respect to the market?
• You could see opportunities?
47
Business Intelligence
A set of tools and techniques
that help people and companies
make better decisions
48
BI Technologies • Data Warehousing • OLAP • Executive Dashboards • Data Mining • Decision Support Systems (DSS) • Expert Systems
10/11/12
9
49
Drowning in Data Starving for Information
50
Data Warehousing
Data
Information Assets
51
Warehouses Report the Facts
• Who • What • When • Where • Why
52
OnLine Analy.cal Processing OnLine Analytical Processing
The process of slicing and dicing data: – Drill Down – Drill Up – Drill Across
OLAP
53
OLAP Example
Analyze quarterly sales
– Expected 10% increase in revenue – Realized a 9.5% increase – Why did quarterly revenue fall short
of expectations?
54
Investigate the Facts
• Why were sales short of expectations? • When – Time Dimension
– Compare sales in Q1 2005 to Q1 2006
• What -- Product Dimension • Who -- Customer Dimension
10/11/12
10
55
Dimensional Model
Time Day Week Month Quarter Year Weekend Holiday
Product Department Category Brand Weight
Customer Age Gender Status Income
56
When
Time Dimension
Year Quarter
Month Week
Day
57
Time Dimension
2005 Q1
Q2
Q3
Q4
Q1
Q2
2006
T ime
58
Sales by Quarter
Q1 ‘05 Q1 ‘06
$100
$109.5 é 9.5%
Quarter
59
Drill Down into Department
- Clothes - Electronics - Books
What
Product Hierarchy
Category
Brand
Product
Department
60
Product Dimension
2 0 0 5 Q 1 Q 2
Q 3
Q 4
Q 1
Q 2
2 0 0 6
T i m e
P r o d u c t
B o o k s E l e c t r o n i c s C l o t h e s
10/11/12
11
61
Sales By Department
Clothes Electronics Books
10%
10.3% 10.4% 8.7%
Q1 ‘06
Q1 ‘06
Q1 ‘06
Dept
62
Drill Down into Books
Product Hierarchy
Category
Brand
Product
Department
63
Product Dimension
2005 Q1
Q2
Q3
Q4
Q1
Q2
2006
Time
Product
BooksElectronicsClothes
Novels
Textbooks
64
Sales by Book Category
10%
Novels
10.6%
Textbooks
Q1 ‘06
6.8%
Q1 ‘06
Category
65
Who
• Age group • Gender • Marital status • Occupation • Annual income
Customer Dimension
66
Drill Down into Age Group
10%
25 - 45
10.9%
Q1 ‘06
4.2%
Q1 ‘06
Under 25 46 - 65
10.4%
Q1 ‘06
Over 65
11.1%
Q1 ‘06
Age
10/11/12
12
67
Customer Dimension
2005 Q1
Q2
Q3
Q4
Q1
Q2
2006
Time
Product
BooksElectronicsClothes
Customer
Under 25
Over 65
25 - 45
46 - 65
Novels
Textb
ooks
68
Analysis
• Sales of textbooks to customers under 25 (students) fell well short of expectations
• What should the company do? • Increase advertisements and incentives
for textbooks to students
69
Executive Dashboards
70
Monitoring Your Business
• Management by Objective (MBO) – Sales -- revenue targets – Customer Support -- customer satisfaction
• Key Performance Indicators (KPI) – Measure performance
• Dashboard Displays KPIs – Color coded Green Yellow Red
71
Example Dashboard
72
Clicking on Virginia drills down to Inventory by City
Alexandria Richmond Roanoke
Inventory Level
10/11/12
13
73
Data Mining
Knowledge Discovery
Identify patterns in your data
74
Market Basket Analysis Identify items purchased together
75
Data Mining Tasks
• Predict – Churn Analysis – Increase response rate
• Estimate – Customer satisfaction and renewal rate
• Classify – Fraud Detection
76
Business Intelligence Systems
77
Enterprise Architecture
Production Systems
Extract Load
Transform
Data Warehouse
Reporting OLAP GUI
Data Mining External
Data Sources
Database Classes
• Database I (340) – Database Development
• Database II (441) – Database Administra.on
• Data Warehousing, Mining, Repor.ng (442) – Data Analysis
78