Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Applications

Similar presentations


Presentation on theme: "Database Applications"— Presentation transcript:

1 Database Applications
CSCI260 Database Applications Chapter Four Data Modeling and the Entity-Relationship Model The Heather Sweeney Design Example

2 About the business Heather Sweeny is an interior decorator.
Specializes in home kitchen design. Offers seminars at home shows and appliance stores. Seminars are free – used to build customer base, sell products and consulting services.

3 About the business After someone attends seminar, Heather wants to sell that person a product or service. Wants to develop database to keep track of customers, the seminars they have attended, and the purchases they have made.

4 The Seminar Customer List
Each seminar has a list of customers that attend it. Includes basic data about seminar as well as the attendees.

5

6 The Seminar Customer List
Two potential entities: SEMINAR and CUSTOMER. From list, it looks like a SEMINAR relates to many CUSTOMERs. There are facts missing, but we can still create an initial E-R Diagram.

7

8 The Seminar Customer List
Customers can attend as many seminars as they wish. Actually they do not need to attend seminar to get into database. She never offers a seminar to fewer than 10 attendees. Add more data to E-R Diagram…

9

10 The Seminar Customer List
Need to be able to add seminar to database, whether it has customers or not. Need to assign identifiers. SEMINAR – surrogate key (instead of really large composite key) CUSTOMER – address

11

12 Customer Form Letter Heather sends a form letter to all attendees.
Several different letters… form letter 1, form letter 2, form letter 3, etc… Wants to be able to send s as well

13

14 Customer Form Letter Create entity CONTACT
ContactNumber – which form letter. ContactType – form letter or . Relates to both Customers and Seminars. Seminar can result in many contacts. Customer may receive many contacts. Neither a customer nor a seminar need to generate a contact.

15

16 Customer Form Letter Can a Contact exist without a seminar? yes.
Can a contact exist without a customer? No. CONTACT is a weak entity depending on CUSTOMER. ID-Dependant – the identifier of CONTACT includes the identifier of CUSTOMER.

17

18 Customer Form Letter Heather never contacts a customer more than once in any particular day. Date can be identifier for CONTACT. Problem – form letter needs customer’s address, but it isn’t in the CUSTOMER entity. Must be added.

19

20 Sales Invoice Used to sell books and videos.
Doesn’t record credit card numbers in database, just payment type.

21

22 Sales Invoice INVOICE needs to be entity.
Should not contain Customer information – keep that in CUSTOMER entity. Still data missing about some of the lines on the invoice form.

23

24 Sales Invoice There are multiple line-items in the invoice – cannot store in INVOICE entity. Create weak entity LINE-ITEM to store each line then relate back to INVOICE entity.

25

26 Sales Invoice LINE-ITEM needs an identifier. LineNumber.
The products sold have standardized names and prices. Create PRODUCT entry and relate it to LINE-ITEM.

27

28 Sales Invoice Note UnitPrice appears in both LINE-ITEM and PRODUCT.
Want to be able to update price of product without effecting past INVOICES. When Invoice created, the UnitPrice is copied from the PRODUCT entity to the LINE-ITEM entity. Down the road, if price of product goes up, it won’t change the past INVOICES.

29


Download ppt "Database Applications"

Similar presentations


Ads by Google