James River Jewelry is a small jewelry shop. While James River Jewelry does sell typical jewelry purchased form jewelry vendors, including such items as rings, necklaces, earrings, and watches, it specializes in hard-to-find Asian jewelry. Although some Asian jewelry is manufactured jewelry purchased from vendors in the same manner as the standard jewelry is obtained, many of the Asian jewelry pieces are often unique single items purchased directly from the artisan who created the piece (the term “manufactured” would be an inappropriate description of these pieces). It has a small but loyal clientele, and it wants to further increase customer loyalty by creating a frequent buyer

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

James River Jewelry is a small jewelry shop. While James River Jewelry does sell typical jewelry purchased form jewelry vendors, including such items as rings, necklaces, earrings, and watches, it specializes in hard-to-find Asian jewelry. Although some Asian jewelry is manufactured jewelry purchased from vendors in the same manner as the standard jewelry is obtained, many of the Asian jewelry pieces are often unique single items purchased directly from the artisan who created the piece (the term “manufactured” would be an inappropriate description of these pieces). It has a small but loyal clientele, and it wants to further increase customer loyalty by creating a frequent buyer program. In this program, after every 10 purchases, a customer will receive a credit equal to 50 percent of the sum of his or her 10 most recent purchases. This credit must be applied to the next (or “11th”) purchase.

Figure D-1 shows data that James River Jewelry collects for its frequent buyer program.

A. Using these data, state assumptions about functional dependencies among the columns of data. Justify your assumptions on the basis of these sample data and also on the basis of what you know about retail sales.

B. Given your assumptions in part A, comment on the appropriateness of the following designs:

    1. CUSTOMER (Name, Phone, Email, InvoiceNumber, InvoiceDate, PreTaxAmount)
    2. CUSTOMER (Name, Phone, Email, InvoiceNumber, InvoiceDate, PreTaxAmount)
    3. CUSTOMER (Name, Phone, Email, InvoiceNumber, InvoiceDate, PreTaxAmount)
    4. CUSTOMER (CustomerID, Name, Phone, Email, InvoiceNumber, InvoiceDate,
      PreTaxAmount)
    5. CUSTOMER (Name, Phone, Email)

and

PURCHASE (InvoiceNumber, InvoiceDate, PreTaxAmount)

  1. CUSTOMER (Name, Phone, Email)

and

PURCHASE (InvoiceNumber, InvoiceDate, PreTaxAmount, Email)

  1. CUSTOMER (Name, Email)

and

PURCHASE (InvoiceNumber, Phone, InvoiceDate, PreTaxAmount, Email)

C. Modify what you consider to be the best design in part B to include a column called AwardPurchaseAmount. The purpose of this column is to keep a balance of the customers’ purchases for award purposes. Assume that returns will be recorded with invoices having a negative PreTaxAmount.

D. Add a new AWARD table to your answer to part C. Assume that the new table will hold data concerning the date and amount of an award that is given after a customer has purchased 10 items. Ensure that your new table has appropriate primary and foreign keys.

 

FIGURE 2-32
Sample Data for Garden Glory
PropertyName
Eastlake Buiding
Elm St Apts
Jeferson Hill
Eastlake Building
Eastlake Building
Elm St Apts
Eastlake Building
Type
Office
Apartment
Office
Office
Office
Apartment
Office
Street
123 Eastlake
4 East Elm
42 West 7th St
123 Eastlake
123 Eastlake
4 East Elm
123 Eastlake
ZIP
98119
98223
98040
98119
98119
ServiceDate
5/5/2012
5/8/2012
5/8/2012
5/10/2012
5/12/2012
5/15/2012
5/19/2012
Amount
City
Seattle
Lynnwood
Bellevue
Seattle
Seattle
Lynnwood
Seattle
Description
Lawn Mow
Lawn Mow
Garden Service
Lawn Mow
Lawn Mow
Lawn Mow
Lawn Mow
42.50
123.50
53.00
%24
42.50
%24
42.50
98223
123.50
98119
42.50
SSSS
Transcribed Image Text:FIGURE 2-32 Sample Data for Garden Glory PropertyName Eastlake Buiding Elm St Apts Jeferson Hill Eastlake Building Eastlake Building Elm St Apts Eastlake Building Type Office Apartment Office Office Office Apartment Office Street 123 Eastlake 4 East Elm 42 West 7th St 123 Eastlake 123 Eastlake 4 East Elm 123 Eastlake ZIP 98119 98223 98040 98119 98119 ServiceDate 5/5/2012 5/8/2012 5/8/2012 5/10/2012 5/12/2012 5/15/2012 5/19/2012 Amount City Seattle Lynnwood Bellevue Seattle Seattle Lynnwood Seattle Description Lawn Mow Lawn Mow Garden Service Lawn Mow Lawn Mow Lawn Mow Lawn Mow 42.50 123.50 53.00 %24 42.50 %24 42.50 98223 123.50 98119 42.50 SSSS
Expert Solution
Step 1

A. Write SQL CREATE TABLE statements for each of these tables.

 

Answer)

 

CREATE TABLE CUSTOMER (

 CustomerID Integer Primary Key IDENTITY (100,10),

 LastName Char(50),

 FirstName Char(50) Not Null,

 Phone Char(12),

 Email VarChar(100)

);

CREATE TABLE PURCHASE (

 InvoiceNumber Integer Primary Key,

 InvoiceDate Date Not Null,

 PreTaxAmount Money Not Null,

 CustomerID Integer Not Null

);

CREATE TABLE PURCHASE_ITEM (

 InvoiceNumber Integer Not Null,

 ItemNumber Integer Not Null,

 RetailPrice Money Not Null

);

ALTER TABLE PURCHASE_ITEM ADD CONSTRAINT PurchaseItemPK PRIMARY KEY (InvoiceNumber, ItemNumber);

CREATE TABLE ITEM(

 ItemNumber Integer Primary Key,

 Description Char(100) Not Null,

 Cost Money Not Null,

 ArtistName Char(100)

);

 

B. Write foreign key constraints for the relationships in each of these tables. Make your own assumptions regarding cascading deletions and justify those assumptions.

 

Answer)

 

ALTER table PURCHASE ADD CONSTRAINT CustomerFK FOREIGN KEY (CustomerID) REFERENCES CUSTOMER;

 

ALTER table PURCHASE_ITEM ADD CONSTRAINT PurchaseFK FOREIGN KEY (InvoiceNumber) REFERENCES PURCHASE ON DELETE CASCADE;

 

ALTER table PURCHASE_ITEM ADD CONSTRAINT ItemFK FOREIGN KEY (ItemNumber) REFERENCES PURCHASE;

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Data Modeling Concepts
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education