Download presentation
Presentation is loading. Please wait.
Published byAudra Edwards Modified over 9 years ago
1
Prepare an ERD for the following scenario Renting a movie at Blockbuster: Each movie is described by an ID, name, genre (horror, comedy, drama, romantic, and foreign) A movie can be rented by one or many customers. A customer is described by an ID, name, address, credit card number.
2
Faculty Course Teaches FacultyID First name Last Name Last Name Course Number Course name Semester Describe the relationship in this ERD and convert into tables
3
Faculty FacultyID FirstName LastName Course CourseNumber CourseName Faculty-Course FacultyCourseID FacultyID CourseNumber Semester FacultyCourseIDFacultyIDCourseIDSemester 1510Spring 2011 2512Fall 2011 3310Spring 2011 4312Fall 2011 Converting that ERD into a schema
4
Pet PetID INT OwnerID INT Name VARCHAR(30) Weight DECIMAL(5,1) Type (dog, cat, fish) VARCHAR(25) Owner OwnerID INT Name VARCHAR(30) Street VARCHAR(55) City VARCHAR(25) State VARCHAR(2) Zip VARCHAR(10) Query this database (petdb) 1)How much does “Fluffy” weigh? 2)What is the average weight of a cat? 3)What is the name of the owner of “Snuggles”?
5
1)How much does “Fluffy” weigh? SELECT pet.weight FROM petdb.pet WHERE pet.name = ‘Fluffy’ 2) What is the average weight of a cat? SELECT AVG(pet.weight) FROM petdb.pet WHERE pet.type = ‘Cat’ 3) What is the name of the owner of “Snuggles”? SELECT owner.name FROM petdb.owner, petdb.pet WHERE owner.ownerid = pet.ownerid AND pet.name = ‘Snuggles’
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.