420 likes | 547 Views
CSC100. Databases Marni Ferner. A Few Well-Known Examples. Itunes & Ipods Amazon.com Ebay LL Bean Wal-Mart. Components of a Database System. Components of a Database System. Why not just use a spreadsheet?. Problems with Flat Tables: Redundancy and Multiple Themes.
E N D
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
Potential Problems: DeletionWhat if Ariel Johnson is deleted?
Potential Problems: UpdatesWhat if the fee for Advanced Pastels changes?
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?
Potential Problems: InsertionHow do we add a new course? Lots of empty space
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
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 SELECTCUSTOMER.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
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. Aselect 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 Management System Software
What is a database and how does it organize information? Database Basics
What is a database and how does it organize information? A databaseis 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 databaseis 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 databaseis 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 Database Basics • data type: usually numeric or text (numbers and text) • name: assigned by person developing the database • size: number of characters that can be entered
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 Database Basics • 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
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 Database Basics • 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
Traditional databaseorganizes 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. Database Basics
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 WEB Sponges 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 Dataand 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