Assignment 14: Modifying a Database Schema Lab Read Snyder Chapter 14 Exs _____ Do: Lab 3.4 Total due: start of class, 8/3 10 Points Total Name_____________________ Post-lab Questions Write your answers after completing the lab, but read them carefully now and keep them in mind during the lab. 1. Suppose you removed a movie from the movie database. Would this be an example of changing the database schema? Answer yes, no, or it depends and explain your answer. 2. In this lab, we add a field to the Movie table for MPAA rating. Think of another piece of data you associate with movies that could be stored in a new field in the Movie table. Be careful when answering this question. You might, for instance, think that cast members would be a natural addition to the Movie table. However, you can easily imagine wanting to store more information than just the names of actors/actresses in the movie database, and this suggests that the right way to add them to the database is using a separate table, rather than just adding a field to the Movie table. (We store data about directors in a separate table for the same reason.). There’s an additional twist, in fact, because actors/actresses and movies have a many-to-many relationship, which, in fact, we haven’t learned how to represent. 3. Give an example of a modification to the movie database (other than those you’ve seen in lab) that does not require changing the schema. 4. Give an example of a modification to the movie database (other than those you’ve seen in lab) that does require changing the schema. 5. What advantages do spreadsheets have over databases for storing, maintaining, and viewing data? What advantages do databases have over spreadsheets? Lab Questions Part 1 2. Add a new movie attribute, MPAARating. (Recall that Access calls attributes “fields.”) Adding a field is very simple in Design View. Just fill in the blank row below the last field, which should be ReleaseYear. MPAA movie ratings are represented using letters and numbers (e.g., PG-13). Which Data Type do you think you should choose? 5. Try entering invalid ratings for a movie. Try entering a nonsensical movie rating like A or even your name in the MPAARating column for a movie. Does an error message result? 7. What is the field size that Access automatically sets for new fields (i.e., the default field size)? Why is it a good idea to reduce the field size for MPAARating to 5? 9. Switch back to Datasheet View and try editing the MPAARating field. What happens when you click to select the field? What happens when you type in a valid rating, rather than choose it from the list? What happens when you type in an invalid rating? Part 2 15. Recall that there is a “one-to-many” relationship between directors and movies (i.e., each director can be related to multiple movies, but not vice versa). How would you best characterize the relationship between reviews and movies? How would you best characterize the relationship between reviews and reviewers? 21. Open the Relationships window. You can do this from the menu bar by selecting Tools \ Relationships... or clicking the Relationships button on the toolbar. What table(s) are displayed in the Relationships window? In each table, one of the fields is shown in bold face. What makes this field different from the other fields in the table? Recall that in the Relationships window, relationships are depicted by lines between table fields. What relationship(s) are displayed in the Relationships window? Each relationship connects two tables. For each relationship, which field from each table is used to represent the relationship? That is, which fields are connected by the lines? 23. Which Movie field will be used to represent the movie-review relationship? Is this a primary key? Which Review field will be used to represent the movie-review relationship? Is this a primary key? Chapter 15 Exercises: Multiple choice 1____ 2____ 3____ 4____ 5____ 6____ 7____ 8____ 9____ 10____ 11____ 12____ Short answer 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.