Case study Lisa’s Bookstore IST210
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
Draw Entities AUTHOR PUBLISHER AuthorID PublisherName Name Country Location Phone BOOK BOOKID Title Year Publisher AuthorID IST210
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
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
Maximum cardinality AUTHOR PUBLISHER AuthorID PublisherName Name Country Location Phone BOOK BOOKID Title Year IST210
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
Case Study: Lisa Bookstore (2) A customer can be uniquely identified using his/her email 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
AUTHOR PUBLISHER AuthorID PublisherName Name Location Country Phone BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER EmailAddress Name Address Phone IST210
AUTHOR PUBLISHER AuthorID PublisherName Name Location Country Phone BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER EmailAddress Name Address Phone IST210
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
AUTHOR PUBLISHER AuthorID PublisherName Name Location Country Phone BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER Event EmailAddress EventID Name Address Phone Name Date Type IST210
AUTHOR PUBLISHER AuthorID Complete E-R Diagram PublisherName Name Country Location Phone BOOK BOOKID Title Year PURCHASE PurchaseID Price Date CUSTOMER Event EmailAddress EventID Name Address Phone Name Date Type IST210