• Falcon Security stores sequentially numbered digital video files in separated directories for each client.. • Need database to track video files.. Q5: How are data models used for data
Trang 1Database Processing
Chapter 5
Trang 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 video files 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?
Trang 3Study Questions
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?
Trang 4Q1: 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.
– Ex: student grades, student emails, student office visits.
Trang 5A List of Student Grades Presented in a Spreadsheet – Single Theme
Trang 6Student 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
Trang 7Q2: What Is a Database?
Trang 8Hierarchy 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
Trang 9Components of a Database
Trang 11Sample of Access Metadata
Trang 12Ethics 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?
Trang 13Ethics Guide: Querying Inequality? (cont’d)
• 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?
Trang 14So 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.
Trang 15Q3: What Is a Database Management System (DBMS)?
• Program to create, process, administer a database.
• Licensed from vendors
– IBM, Microsoft, Oracle, and others.
DB2, Access, SQL Server, Oracle Database.
– MySQL: License-free for most applications.
Trang 17Processing the Database
• Structured Query Language - SQL (see-quell)
– International standard
SQL Example
INSERT INTO Student
([Student Number], [Student Name], HW1, HW2, MidTerm)
VALUES (1000, ‘Franklin, Benjamin’, 90, 95, 100);
Trang 18Adding 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
Trang 19Administering the Database
• 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.
Trang 20Summary 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
Trang 21Summary of Database Administration Tasks (cont'd)
Trang 23Q4: How Do Database Applications Make Databases More Useful? (cont'd)
Trang 24Example 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
Trang 25Query Example
Trang 26Browser 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
Trang 27Account Creation Browser Form
Trang 28Browser
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
Trang 29Graphical Query: User Clicks on Video Icon to Find All Videos from that Location
Trang 30Multiuser 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
3
4 Jeffrey puts both in shopping basket and checks out before Andrea
4
1 Andrea proceeds to checkout
Someone will be disappointed.
5
Trang 31Q5: How Are Data Models Used for Database
Development?
Trang 32Entities
• Describe characteristics of entity.
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
Trang 33Student Data Model Entities
Trang 34Example 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
Trang 351:N One department may have many advisers, but an adviser may be
in only one department
Trang 37Crow’s-Foot Diagram Version
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.
Trang 39Data Integrity Problems
• Data integrity problems
– Incorrect or inconsistent information
– Users lose confidence in information.
– System gets a poor reputation.
• Can only occur if data are duplicated.
Trang 40Poorly 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
Trang 41Two Normalized Tables
Single Themes
Trang 42Summary 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
Trang 43Representing 1:N Relationships
Trang 44Representing 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
Trang 45Users’ Role in the Development of Databases
• 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.
Trang 46Q7: 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?”
Trang 47Falcon Security Chooses Option 1
• Use Access to store metadata
• Less risky: uses known technology
• Creates E-R diagram
• Decide to keep design simple at first.
Trang 48Q8: 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.
Trang 49ACID Transactions
• Atomic, Consistent, Isolated, Durable transactions.
• Critical to traditional commercial applications.
• New Internet applications (Twitter) don’t need ACID.
Trang 50New 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.
Trang 51New Categories of DBMS (cont’d)
2 NewSQL DBMS
3 In-memory DBMS using SQL extension
Trang 52Q8: 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.
Trang 53Security Guide: Theft by SQL Injection
• 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.
Trang 54Security 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
Trang 55Security Guide: Theft by SQL Injection (cont'd)
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.
Trang 56Guide: 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.
Trang 57Active Review
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?
Trang 58Case 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.
Trang 59Pianos in Storage
Trang 60Columns 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
Trang 61Query Design and Result
Trang 62Piano 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