Download presentation
Presentation is loading. Please wait.
1
Case study Lisa’s Bookstore IST210
2
Case Study: Lisa’s Bookstore (1)
You are helping Lisa maintain information of her bookstore. A book contains information about book title, publisher, author names, and publication year. For a publisher, store the information about name, location, phone number. An author’s name and country should be stored in the database. IST210
3
Draw Entities AUTHOR PUBLISHER AuthorID PublisherName Name Country
Location Phone BOOK BOOKID Title Year Publisher AuthorID IST210
4
Publisher and Author should NOT be the attributes of the book!
Draw Entities AUTHOR PUBLISHER AuthorID PublisherName Name Country Location Phone BOOK BOOKID Title Year Publisher AuthorID Publisher and Author should NOT be the attributes of the book! Information of publisher and author for a book is captured by the relationships! IST210
5
Attribute v.s. Foreign Key
Please note that there is NO foreign key concept in E-R diagram. Do not make a foreign key as an attribute in the E-R diagram. For example, PublisherName should NOT be an attribute of the BOOK entity. Their relationship is currently represented by the line and the corresponding min/max cardinality. In Chapter 5, we will learn how to transform a E-R diagram to tables. At that point, some relationships might be transformed into foreign key. IST210
6
Maximum cardinality AUTHOR PUBLISHER AuthorID PublisherName Name
Country Location Phone BOOK BOOKID Title Year IST210
7
Minimum cardinality is 0,
BOOKID Title Year AuthorID Name Country PublisherName Location Phone BOOK AUTHOR PUBLISHER Minimum cardinality is 1, if Lisa only wants to store the authors who have at least one book in her bookstore. Minimum cardinality is 0, if Lisa also wants to be able to keep track of some publishers that currently have no books in her bookstore’s inventory. You may want to ask Lisa for the choice of the minimum cardinalities here IST210
8
Case Study: Lisa Bookstore (2)
A customer can be uniquely identified using his/her address. A customer has information about his/her name, phone number and home address. Lisa wants to track all the book purchases. Each purchase is made by one customer on one book. The price and date of the purchase will be stored in database. A customer may purchase many books or not purchase any book. IST210
9
AUTHOR PUBLISHER AuthorID PublisherName Name Location Country Phone
BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER Address Name Address Phone IST210
10
AUTHOR PUBLISHER AuthorID PublisherName Name Location Country Phone
BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER Address Name Address Phone IST210
11
Case Study: Lisa Bookstore (3)
In Lisa’s bookstore, there are some events organized to interact with the customers. Lisa wants to record the information of events, including event name, type, and date. She also wants to record which customers attend which events. IST210
12
AUTHOR PUBLISHER AuthorID PublisherName Name Location Country Phone
BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER Event Address EventID Name Address Phone Name Date Type IST210
13
AUTHOR PUBLISHER AuthorID Complete E-R Diagram PublisherName Name
Country Location Phone BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER Event Address EventID Name Address Phone Name Date Type IST210
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.