1 / 13

Motivation for usin 1 g a database

Motivation for usin 1 g a database. Why Use a Database. Data Management Example. Scenario You are a DVD store owner. You are a DVD store owner. Customers rent DVDs of movies. Several copies of each movie. Needs Which DVDs has a customer rented? Are any DVD overdue?

Download Presentation

Motivation for usin 1 g a database

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Motivation for usin1g a database Why Use a Database --Motivation for using a database--

  2. Data Management Example • Scenario You are a DVD store owner. • You are a DVD store owner. • Customers rent DVDs of movies. • Several copies of each movie. • Needs • Which DVDs has a customer rented? • Are any DVD overdue? • When will a DVD become available? --Motivation for using a database--

  3. Solution: A File-based System • Edit rented.txt file Customer: Cindy Liu, Rented: Harry Potter, Due: Set. 19, 2007 . . . • Advantages • Text editors are easy to use • Simple to insert a record • Simple to delete a record --Motivation for using a database--

  4. Complication: Queries • Does not address needs Query: What movies has Cindy Liu rented? Execute (not quite right): Search for ‘Cindy Liu’. Search for ‘^\s+Customer:\s*Cindy\s+Liu\s*,\s+Rented:’. Query: Are any DVDs overdue? Execute: ??? • Requirements • Robust, sophisticated query language • Clear separation between data organization (schema) and data --Motivation for using a database--

  5. Complication: Queries • Lacks data integrity, consistency • Clerk misspells value/field Customer: Cindy Lui, Rented: Harry Potter, Deu: Sep. 19, 2007 • Inputs improper value, same value differently Customer: Cindy Liu, Rented: Harry Potter2, Due: Sep. 29, 2007 • Forgets/adds/reorders field Terms: weekly special Due: Sep. 19, 2007, Rented: Harry Potter • Requirements • Enforce constraints to permit only valid information to be input. --Motivation for using a database--

  6. Complication: Update • Add/delete/update fields in every record • Record store location. Customer: JD, Rented: Babe, Due: Sep. 19, 2007, Store: Bry • Modify customer to first and surname. First: Joe, Surname: Doe, Rented: Babe, Due: Sep. 29, 2004 • Add/delete/update new information collections • customer.txt file to record information Customer: Jane Doe, Phone: 5575 3344 • Requirements • Ability to manipulate the way data is organized. --Motivation for using a database--

  7. Complication: Multiple Users • Two clerks edit rented.txt file at the same time. 1) Ben starts to edit rented.txt, reads it into memory. 2) Sarah starts to edit rented.txt. 3) Ben adds a record. 4) Ben saves rented.txt to disk. 5) Sarah saves rented.txt to disk. Ben’s added record disappears! • Requirements • Must support multiple readers and writers. • Updates to data must (appear to) occur in serial order. --Motivation for using a database--

  8. Complication: Crashes • Crash during update may lead to inconsistent state. • Ben makes 250 of 500 edits to change Jane Doe to her preferred name Jan Doe. • Before he saves it, Windows crashes! • Requirements • Must update on all or none basis. • Implemented by commit or rollback if necessary. --Motivation for using a database--

  9. Complication: Data Physically Separate • Wants • Want to advise Austin Power’s fans about new A P’s movie. • Method • customer.txt contains addresses of customers. • Must merge with rented.txt to create mailing list. • Problems • Text editors incapable of such a merge (write a program) • Several Joe Jenkins • Requirements • Uniquely identify each customer. --Motivation for using a database--

  10. Complication: Security • Customers want to know how many times a movie has been rented. • Provide access to rented.txt, but not to customer field, how to I do that in an editor? • Underage clerks should not see history of R-rated rentals. • Keep two lists of rentals? • Requirements • Ability to control who has access to what information. --Motivation for using a database--

  11. Complication: Efficiency • All DVD store owners in Dublin get together • rented.txt file gets huge (gigabytes of data). • Slow to edit. • Slow to query for customer information. • Requirements • New data structures to improve query performance. • System automatically modifies queries to improve speed. • Ability of system to scale to handle huge datasets. --Motivation for using a database--

  12. Complication: New Needs • All DVD store owners in Dublin get together. • What pairs of movies are often rented together? • Calculate probability of movie combinations. • Do we need more copies of the Austin Powers movie anywhere? • Plot rental history of Austin Powers by store area. • Requirements • Collect and analyse summary data. • Use computer to mine for interesting trends. • Support access to data by sophisticated programs. --Motivation for using a database--

  13. File-based Systems - Overview • A DVD store owner develops a system based on files. DVD rental checkin program new DVD ordering program customer mailing program rented DVD file customer file inventory master file --Motivation for using a database--

More Related