csc100 databases marni ferner. a few well-known examples itunes & ipods amazon.com ebay ll bean...
TRANSCRIPT
CSC100
DatabasesMarni Ferner
A Few Well-Known Examples
• Itunes & Ipods• Amazon.com• Ebay• LL Bean• Wal-Mart
1-3
Components of a Database System
1-4
Components of a Database System
Why not just use a spreadsheet?
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$
Modification Issues
• Redundancy and multiple themes create modification problems– Deletion problems– Update problems– Insertion problems
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?
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
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?
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?
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
A Better Solution
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
But, how do we re-create the original data?
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
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;
A Relational Database Solves the Problems of Lists and adds
THE POWER OF QUERIES
Database Management System Software
Query Tools
Database Management System Software
Query Tools
– Query tools help users narrow down information needed to be searched.
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.
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.
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.
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.
Database Basics
What is a database and how does it organize information?
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.
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.
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.
Database Basics
Levels of Data within a Database
Database Basics
Levels of Data within a Database– Entity – a person, place, thing, or event
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
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
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
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.
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.
Current and Future Applications
THE WEBSponges of the Caribbean
Current and Future Applications
Data Warehousing and Data Mining
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
Current and Future Applications
Biometrics
Ethics and Privacy Issues
Discussion Topic:
Sharing Criminal Data and Megan’s Law
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
The End