kroenke umis9e inppt 05 -...

Post on 27-Jul-2018

215 views 0 download

Transcript of kroenke umis9e inppt 05 -...

Database Processing

Chapter 5

5-2

“We Don’t Have a Way to Track the Data About the Videos.”

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Falcon Security stores sequentially numbered digital videofiles in separated directories for each client.

• Tracking down exact footage of when equipment stolen means searching hundreds of video files.

• Need database to track video files.• MongoDB for tracking video files?

5-3

Study Questions

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

Q1: What is the purpose of a database?Q2: What is a database?Q3: What is a database management system (DBMS)?Q4: How do database applications make databases more useful?Q5: How are data models used for database development?Q6: How is a data model transformed into a database design? Q7: How can Falcon Security benefit from a database system?Q8: 2026?

5-4

Q1: What Is the Purpose of a Database?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Organize and keep track of things.• Keep track of multiple themes.• General rule:

– Single theme - store in a spreadsheet.– Multiple themes - use a database.

• What's a theme?– Ex: student grades, student emails, student office visits.

5-5

A List of Student Grades Presented in a Spreadsheet – Single Theme

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-6

Student Data Form for a Database Application

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-7

Q2: What Is a Database?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-8

Hierarchy of Data Elements

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-9

Components of a Database

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-10

Example of Relationships Among Rows

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-11

Sample of Access Metadata

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-12

Ethics Guide: Querying Inequality?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• MaryAnn has a data mart.• Business professional majored in HR, now "expert" in SQL.• Uses SQL to do job faster and better.• Examined data, saw possible discriminatory pattern.• What would you do from categorical imperative and utilitarian

perspectives?

5-13

Ethics Guide: Querying Inequality? (cont’d)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Queries could reveal all sorts of patterns and trends.– Be sure what answers you want before starting query.

• How strongly do you feel about social and personal responsibility, considering your needs and those of your family?

• How important is social responsibility posture of an employer to you?–Is that something to add to your criteria for a job search?

5-14

So What? Not What the Data Says . . .

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Subjective: – Small, nonrandom sample.– Called four different sales reps who can’t get any prospects

to bite. • Objective:

– Same month historical data, seasonal data comparisons.• How to recognize and minimize bias?

– Use non-routine cognitive skills.

5-15

Q3: What Is a Database Management System (DBMS)?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Program to create, process, administer a database.• Licensed from vendors

–IBM, Microsoft, Oracle, and others.DB2, Access, SQL Server, Oracle Database.

• Open source– MySQL: License-free for most applications.

5-16

Processing the Database

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

DBMS Process Operations 1. Read2. Insert3. Modify4. Delete data

5-17

Processing the Database

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Structured Query Language - SQL (see-quell)– International standard – Used by nearly all DBMS

SQL ExampleINSERT INTO Student([Student Number], [Student Name], HW1, HW2, MidTerm)VALUES (1000, ‘Franklin, Benjamin’, 90, 95, 100);

5-18

Adding a New Column to a Table (in Access 2013)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-19

Administering the Database

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Set up security system, user accounts, passwords, permissions, limits for processing.

• Limit user permissions.• Back up database, improve performance of database

applications, remove unwanted data.

5-20

Summary of Database Administration Tasks

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-21

Summary of Database Administration Tasks(cont'd)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-22

Q4: How Do Database Applications Make Databases More Useful?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

Forms View data; insert new, update existing, delete existing data.

QueriesSearch using values provided by user.

ReportsStructured presentation of data using sorting, grouping, filtering, other operations.

Application programsProvide security, data consistency, special purpose processing, e.g., handleout-of-stock situations.

5-23

Q4: How Do Database Applications Make Databases More Useful? (cont'd)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-24

Example of a Student Report

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-25

Query Example

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-26

Browser Forms, Reports, Queries, and Applications

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-27

Account Creation Browser Form

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-28

Browser Report

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-29

Graphical Query: User Clicks on Video Icon to Find All Videos from that Location

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-30

Multiuser Processing Problem

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

1.Andrea reads pedal record showing balance of 2 pedals.

1

2. Jeffrey reads same record showing balance of 2 pedals.

2

1.Andrea puts both in shopping baskets, but delays checking out.

3

4.Jeffrey puts both in shopping basket and checks out before Andrea.

4

1.Andrea proceeds to checkout. Someone will be disappointed.

5

5-31

Q5: How Are Data Models Used for DatabaseDevelopment?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-32

• Something to track.– Order, customer, salesperson,

item, volunteer, donationEntities

• Describe characteristics of entity.– OrderNumber, CustomerNumber,

VolunteerName, PhoneNumberAttributes

• Uniquely identifies one entity instance from other instances– Student_ID_Number

Identifier

What Is the Entity-Relationship Data Model?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-33

Student Data Model Entities

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-34

Example of Department, Adviser, and Student Entities and Relationships (cont'd)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-35

Sample of Relationships―Version 1

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

Crow’s Feet

N:M An Adviser may have many students, and one student may have many advisers

1:NOne department may have many advisers, but an adviser may be in only one department

5-36

Sample of Relationships─Version 2

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

1:NA student has only one advisor, but an adviser may advise

many students

N:MA department has many

advisors, and an advisor may advise for more than one depart

“Crow’s Foot”

5-37

Crow’s-Foot Diagram Version

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

Maximum cardinality─maximum number of entities in a relationship. Vertical bar on a line means at least one entity required.

Minimum cardinality—minimum number of entities in a relationship. Small oval means entity is optional; relationship need not have entity of that type.

5-38

Q6: How Is a Data Model Transformed into a Database Design?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Normalization– Converting poorly structured tables into two or more well-

structured tables.• Goal

– Construct tables with single theme or entity.• Purpose

– Minimize data integrity problems.

5-39

Data Integrity Problems

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Data integrity problems. – Incorrect or inconsistent information.– Users lose confidence in information.– System gets a poor reputation.

• Can only occur if data are duplicated.

5-40

Poorly Designed Employee Table Causes Data Integrity Problem

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-41

Two Normalized Tables

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

Single Themes

5-42

Summary of Normalization

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-43

Representing 1:N Relationships

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-44

Representing an N:M Relationship: Strategy for Foreign Keys

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-45

Users’ Role in the Development of Databases

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Final judges.• Thorough review of data model.

– Entities must contain all the data users need to do their jobs.– Must accurately reflect their view of the business.

• Take it seriously.• Devote time.

5-46

Q7: How Can Falcon Security Benefit from a Database System?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Find videos by querying their characteristics.– “Which videos do we have of the Beresford Building in

October 2014, shot from 3,000 feet or less?” • Choices

1. Store videos on a file server and keep metadata about each video in a relational database to query with SQL.

2. Use NoSQL MongoDB.

5-47

Falcon Security Chooses Option 1

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Use Access to store metadata.

• Less risky: uses known technology.

• Creates E-R diagram. • Decide to keep design

simple at first.

5-48

Q8: 2026?

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Volume of database continues to grow.• Cheap, unlimited storage, greater processing speeds do in

relational databases.• Security becomes more important.• Many NoSQL, NewSQL, and in-memory databases exist in

commerce.

5-49

ACID Transactions

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Atomic, Consistent, Isolated, Durable transactions.• Critical to traditional commercial applications.• New Internet applications (Twitter) don’t need ACID.

5-50

New Categories of DBMS

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

1. NoSQL DBMS (NotRelational DBMS)• Supports very high transaction rates, processing relatively

simple data structures, • Replicated on many servers in the cloud, without ACID

transaction support. • MongoDB, Cassandra, Bigtable, and Dynamo.

5-51

New Categories of DBMS (cont’d)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

2. NewSQL DBMS• Process very high levels of transactions, like NoSQL DBMS, but

provide ACID support.• May or may not support relational model. • Current hotbed of development.

3. In-memory DBMS using SQL extension• SAP HANA, Tableau.• High volume ACID transaction support with complex relational query

processing.

5-52

Q8: 2026? (cont'd)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Keep abreast of developments.• Watch from investor’s perspective.• New opportunities and career paths will develop around these

new DBMS products.• Separate yourself from the competition when it comes to job

interviews.

5-53

Security Guide: Theft by SQL Injection

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Common way of stealing data from corporations.• Done by people outside of host nation to avoid prosecution. • Highly organized and well-funded.

– Criminal syndicates, nation states, or political hacktivists.– Mandiant report “APT1: Exposing One of China’s Cyber

Espionage Units”• Attempting SQL injection could result in your arrest.

5-54

Security Guide: Theft by SQL Injection (cont'd)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-55

Security Guide: Theft by SQL Injection (cont'd)

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

1. Retailers suffer two times as many SQL injection attacks as other industries.

2. Most Web applications receive four or more Web attack campaigns per month, and others are constantly under attack (176 out of 180 days).

3. One Web site received 94,057 SQL injection attack requests in one day.

5-56

Guide: Immanuel Kant, Data Modeler

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Perception of reality based on our perceptive apparatus.• Brain processes perceptions into something meaningful.• Human’s model what appears to be. • Users determine if a data model fits their perception of reality.

5-57

Active Review

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

Q1: What is the purpose of a database?Q2: What is a database?Q3: What is a database management system (DBMS)?Q4: How do database applications make databases more useful?Q5: How are data models used for database development?Q6: How is a data model transformed into a database design?Q7: How can Falcon Security benefit from a database system?Q8: 2026?

5-58

Case Study 5: Dean's Piano Database

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

• Certified piano tuner and technician repairing and restoring pianos for many years.

• Clown entertainer at children’s parties.

5-59

Pianos in Storage

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-60

Columns in the Piano Table

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-61

Query Design and Result

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

5-62

Piano Sound Quality by Building

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .

C o p y r i g h t © 2 0 1 7 P e a r s o n E d u c a t i o n , I n c .