csc100 databases marni ferner. a few well-known examples itunes & ipods amazon.com ebay ll bean...

42
CSC100 Databases Marni Ferner

Upload: christopher-dorsey

Post on 28-Dec-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

CSC100

DatabasesMarni Ferner

Page 2: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

A Few Well-Known Examples

• Itunes & Ipods• Amazon.com• Ebay• LL Bean• Wal-Mart

Page 3: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

1-3

Components of a Database System

Page 4: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

1-4

Components of a Database System

Page 5: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Why not just use a spreadsheet?

Page 6: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Problems with Flat Tables:Redundancy and Multiple Themes

Customer Phone CourseDate AmtPaid Course FeeAriel Johnson 206.555.1234 10/1/2006 250.00$ Advanced Pastels 500.00$ Robin Green 312.555.6689 9/15/2006 350.00$ Beginning Oils 350.00$ Charles Jackson 306.555.1488 10/1/2006 500.00$ Advanced Pastels 500.00$ Ariel Johnson 206.555.1234 3/15/2006 350.00$ Intermediate Pastels 350.00$ Jeffery Pearson 212.555.8878 10/1/2006 500.00$ Advanced Pastels 500.00$ Miguel Sears 770.555.3289 9/15/2006 350.00$ Begining Oils 350.00$ Leah Kyle 444.555.3833 11/15/2006 250.00$ Advanced Pastels 500.00$

Page 7: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Modification Issues

• Redundancy and multiple themes create modification problems– Deletion problems– Update problems– Insertion problems

Page 8: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Customer Phone CourseDate AmtPaid Course FeeAriel Johnson 206.555.1234 10/1/2006 250.00$ Advanced Pastels 500.00$ Robin Green 312.555.6689 9/15/2006 350.00$ Beginning Oils 350.00$ Charles Jackson 306.555.1488 10/1/2006 500.00$ Advanced Pastels 500.00$ Ariel Johnson 206.555.1234 3/15/2006 350.00$ Intermediate Pastels 350.00$ Jeffery Pearson 212.555.8878 10/1/2006 500.00$ Advanced Pastels 500.00$ Miguel Sears 770.555.3289 9/15/2006 350.00$ Beginning Oils 350.00$ Leah Kyle 444.555.3833 11/15/2006 250.00$ Advanced Pastels 500.00$

Potential Problems: DeletionWhat if Ariel Johnson is deleted?

Page 9: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Customer Phone CourseDate AmtPaid Course FeeRobin Green 312.555.6689 9/15/2006 350.00$ Beginning Oils 350.00$ Charles Jackson 306.555.1488 10/1/2006 500.00$ Advanced Pastels 500.00$ Jeffery Pearson 212.555.8878 10/1/2006 500.00$ Advanced Pastels 500.00$ Miguel Sears 770.555.3289 9/15/2006 350.00$ Beginning Oils 350.00$ Leah Kyle 444.555.3833 11/15/2006 250.00$ Advanced Pastels 500.00$ Linda Myers 509.555.3303 10/15/2006 -$ Beginning Oils 350.00$

Potential Problems: DeletionIntermediate Pastels is gone

Page 10: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Customer Phone CourseDate AmtPaid Course FeeAriel Johnson 206.555.1234 10/1/2006 250.00$ Advanced Pastels 500.00$ Robin Green 312.555.6689 9/15/2006 350.00$ Beginning Oils 350.00$ Charles Jackson 306.555.1488 10/1/2006 500.00$ Advanced Pastels 500.00$ Ariel Johnson 206.555.1234 3/15/2006 350.00$ Intermediate Pastels 350.00$ Jeffery Pearson 212.555.8878 10/1/2006 500.00$ Advanced Pastels 500.00$ Miguel Sears 770.555.3289 9/15/2006 350.00$ Beginning Oils 350.00$ Leah Kyle 444.555.3833 11/15/2006 250.00$ Advanced Pastels 500.00$

Potential Problems: UpdatesWhat if the fee for Advanced Pastels changes?

Page 11: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Customer Phone CourseDate AmtPaid Course FeeAriel Johnson 206.555.1234 10/1/2006 250.00$ Advanced Pastels 400.00$ Robin Green 312.555.6689 9/15/2006 350.00$ Beginning Oils 350.00$ Charles Jackson 306.555.1488 10/1/2006 500.00$ Advanced Pastels 400.00$ Ariel Johnson 206.555.1234 3/15/2006 350.00$ Intermediate Pastels 350.00$ Jeffery Pearson 212.555.8878 10/1/2006 500.00$ Advanced Pastels 500.00$ Miguel Sears 770.555.3289 9/15/2006 350.00$ Beginning Oils 350.00$ Leah Kyle 444.555.3833 11/15/2006 250.00$ Advanced Pastels 400.00$

Potential Problems: UpdatesDoes it change for all offerings?Is the 11/15/2006 date an error or another offering?Did we make ALL of the required changes?

Page 12: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Ariel Johnson 206.555.1234 10/1/2006 250.00$ Advanced Pastels 500.00$ Robin Green 312.555.6689 9/15/2006 350.00$ Beginning Oils 350.00$ Charles Jackson 306.555.1488 10/1/2006 500.00$ Advanced Pastels 500.00$ Ariel Johnson 206.555.1234 3/15/2006 350.00$ Intermediate Pastels 350.00$ Jeffery Pearson 212.555.8878 10/1/2006 500.00$ Advanced Pastels 500.00$ Miguel Sears 770.555.3289 9/15/2006 350.00$ Beginning Oils 350.00$ Leah Kyle 444.555.3833 11/15/2006 250.00$ Advanced Pastels 500.00$ Linda Myers 509.555.3303 10/15/2006 -$ Beginning Oils 350.00$

Beginning Pastels 250.00$

Potential Problems: InsertionHow do we add a new course?Lots of empty space

Page 13: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

A Better Solution

Page 14: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Relational Databases

• A relational database stores information in tables. Each informational topic is stored in its own table

• In essence, a relational database will break-up a list into several parts. One part for each theme in the list

• An Enrollment List would be divided into a CUSTOMER Table, a CLASSES Table, and an ENROLLMENT Table

Page 15: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

But, how do we re-create the original data?

Page 16: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Structured Query Language (SQL)• Structured Query Language (SQL) is an

international standard for creating, processing and querying database and their tables

• Most database applications use SQL to retrieve, format, report, insert, delete, and/or modify data for users

Page 17: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

SQL Example SELECT CUSTOMER.CustomerName,

CUSTOMER.Phone,COURSE.CourseDate, ENROLLMENT.AmountPaid, COURSE.Course, COURSE.Fee

FROM CUSTOMER, ENROLLMENT, COURSE

WHERE CUSTOMER.CustomerNumber

= ENROLLMENT.CustomerNumber

AND

COURSE.CourseNumber

= ENROLLMENT.CourseNumber;

Page 18: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

A Relational Database Solves the Problems of Lists and adds

THE POWER OF QUERIES

Page 19: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Management System Software

Query Tools

Page 20: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Management System Software

Query Tools

– Query tools help users narrow down information needed to be searched.

Page 21: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Management System Software

Query Tools

– Query tools help users narrow down information needed to be searched.

– A query allows users to ask questions designed to retrieve information.

Page 22: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Management System Software

Query Tools

– Query tools help users narrow down information needed to be searched.

– A query allows users to ask questions designed to retrieve information.

– A select command asks a database to return records that match specific criteria.

Page 23: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Management System Software

Query Tools

– Query tools help users narrow down information needed to be searched.

– A query allows users to ask questions designed to retrieve information.

– A select command asks a database to return records that match specific criteria.

– Joining matches data from fields in various tables.

Page 24: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Management System Software

Structured Query Language (SQL)

This SQL statement could search for top students in a college, with “top” defined as those students with a grade point average (GPA) above 3.49.

Page 25: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

What is a database and how does it organize information?

Page 26: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

What is a database and how does it organize information?

A database is a computerized system for storing information in an organized manner so that it can be searched for and retrieved when needed. Information is stored in the form of fields, records, and files.

Page 27: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

What is a database and how does it organize information?

A database is a computerized system for storing information in an organized manner so that it can be searched for and retrieved when needed. Information is stored in the form of fields, records, and files.

Page 28: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

What is a database and how does it organize information?

A database is a computerized system for storing information in an organized manner so that it can be searched for and retrieved when needed. Information is stored in the form of fields, records, and files.

Unlike a list or spreadsheet, a database may store information that is more complicated than a simple list.

Page 29: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

Levels of Data within a Database

Page 30: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

Levels of Data within a Database– Entity – a person, place, thing, or event

Page 31: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

Levels of Data within a Database– Entity – a person, place, thing, or event– Field – a single value, such as a name, address,

or dollar amount• data type: usually numeric or text (numbers and text)• name: assigned by person developing the database• size: number of characters that can be entered

Page 32: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

Levels of Data within a Database– Entity – a person, place, thing, or event– Field – a single value, such as a name, address,

or dollar amount• data type: usually numbers, text, dates, but can also be

other files (BLOBs), URL’s, etc.• name: assigned by person developing the database• size: number of characters that can be entered

– Record – related fields describing an event or situation

Page 33: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database Basics

Levels of Data within a Database– Entity – a person, place, thing, or event– Field – a single value, such as a name, address,

or dollar amount• data type: usually numeric or text (numbers and text)• name: assigned by person developing the database• size: number of characters that can be entered

– Record – related fields describing an event or situation

– File – collection of records of the same type

Page 34: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Database BasicsTraditional database organizes data in a hierarchy. A field is the smallest element. Fields are within a record. Records are organized in a data file. Database is a collection of data files.

Page 35: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Sounds likeMore Work, Not Less

• A relational database is more complicated than a list

• However, a relational database minimizes data redundancy, preserves complex relationships among topics, and allows for partial data

• Furthermore, a relational database provides a solid foundation for user forms and reports and allows the data to be examined in a myriad of different ways.

Page 36: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Current and Future Applications

THE WEBSponges of the Caribbean

Page 37: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Current and Future Applications

Data Warehousing and Data Mining

Page 38: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Wal-Mart“When the world's largest retailer struggles with a database issue, the numbers can be a bit daunting. It's data warehouse, for example, is larger than 4 Petabytes. That's more than 4,096 TBytes, give or take a few million bits. The chain has more than 6,000 stores, with some having almost a half-million SKUs each. You think your Excel spreadsheets are bad? Wal-Mart's database tables have literally 100 billion rows. The retailer's POS systems have to ring up some 276 million items—a day.” Source: StorefrontBacktalk.com

Page 39: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Current and Future Applications

Biometrics

Page 40: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

Ethics and Privacy Issues

Discussion Topic:

Sharing Criminal Data and Megan’s Law

Page 41: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

California was the first state to employ a controversial database. Based on Megan’s Law – the statute named for a seven-year-old girl who was violated and killed by a paroled felon – the database listed the names and addresses of people convicted of crimes against children. Today, all states employ similar databases and are required to share the information with a national database. Most states now allow you to use the databases to find out if these felons live near you. In some communities, when an offender moves in, the police inform the local school system, which in turn sends parents a notification that includes a history, address, and picture of the wrongdoer. Some states share information with each other regarding almost all criminals, and some allow citizens to search for these offenders by name. Touted as a valuable tool in crime prevention, some feel that publishing this information makes it impossible for an offender to lead a normal life and can result in vigilantism – one paroled lawbreaker’s car was firebombed only days after his name was released. Should a database of people paroled or released after the commission of sex crimes be made public? Why or why not? What about those who have committed other types of crimes? What about those awaiting trial? Who should have access to the database, and why? Should there be a cost to accessing this type of data?

 • http://sexoffender.ncdoj.gov/search.aspx

 • http://www1.aoc.state.nc.us/www/calendars/DWIQuery.html

 

Page 42: CSC100 Databases Marni Ferner. A Few Well-Known Examples Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart

The End