Question

Assume that The Queen Anne Curiosity Shop designs a database with the following tables. CUSTOMER (CustomerID,...

Assume that The Queen Anne Curiosity Shop designs a database with the following tables.

CUSTOMER (CustomerID, LastName, FirstName, EmailAddress, EncyptedPassword, City, State, ZIP, Phone, ReferredBy)

EMPLOYEE (EmployeeID, LastName, FirstName, Position, Supervisor, OfficePhone, EmailAddress)

VENDOR (VendorID, CompanyName, ContactLastName, ContactFirstName,

Address, City, State, ZIP, Phone, Fax, EmailAddress)

ITEM (ItemID, ItemDescription, PurchaseDate, ItemCost, ItemPrice, VendorID)

SALE (SaleID, CustomerID, EmployeeID, SaleDate, SubTotal, Tax, Total)

SALE_ITEM (SaleID, SaleItemID, ItemID, ItemPrice)

The referential integrity constraints are:

ReferredBy in CUSTOMER must exist in CustomerID in CUSTOMER

Supervisor in EMPLOYEE must exist in EmployeeID in EMPLOYEE

CustomerID in SALE must exist in CustomerID in CUSTOMER

VendorID in ITEM must exist in VendorID in VENDOR

EmployeeID in SALE must exist in EmployeeID in EMPLOYEE

SaleID in SALE_ITEM must exist in SaleID in SALE

ItemID in SALE_ITEM must exist in ItemID in ITEM

Assume that CustomerID of CUSTOMER, EmployeeID of EMPLOYEE, VendorID of VENFOR, ItemID of ITEM, and SaleID of SALE are all surrogate keys with values as follows:

CustomerID   Start at 1        Increment by 1

EmployeeID   Start at 1        Increment by 1

VendorID        Start at 1        Increment by 1

ItemID             Start at 1        Increment by 1

SaleID             Start at 1        Increment by 1

A vendor may be an individual or a company. If the vendor is an individual, the CompanyName field is left blank, while the ContactLastName and ContactFirstName fields must have data values. If the vendor is a company, the company name is recorded in the CompanyName field, and the name of the primary contact at the company is recorded in the ContactLastName and ContactFirstName fields.

A. Specify NULL/NOT NULL constraints for each table column.

B. Specify alternate keys, if any.

C. State relationships as implied by foreign keys, and specify the maximum and minimum cardinality of each relationship. Justify your choices.

D. Explain how you will enforce the minimum cardinalities in your answer to part C. Use referential integrity actions for required parents, if any. Use Figure 6-28(b) as a boilerplate for required children, if any.

E. Create a database named QACS in your DBMS.

F. Create a folder in your My Documents folder to save and store *.sql scripts containing the SQL statements that you are asked to create in the remaining questions in this section.

  • For the SQL Server Management Studio, create a folder named QACS-Database in the Projects folder structure in your My Documents folder.
  • In the Oracle SQL Developer folder structure in your My Documents folder, create a folder named QACS-Database.
  • For the SQL Workbench, create a folder named QACS-Database in the Schemas folder in your My Documents folder.

G. Write SQL CREATE TABLE statements for each of these tables. Write CREATE TABLE statements for each of the tables using your answers to parts A–D, as necessary. Set the surrogate key values as shown above. Use FOREIGN KEY constraints to create appropriate referential integrity constraints. Set UPDATE and DELETE behavior in accordance with your referential integrity action design. Run these statements to create the QACS tables.

H. Explain how you would enforce the data constraint that SALE_ITEM.UnitPrice be equal to ITEM.ItemPrice, where SALE_ITEM.ItemID = ITEM.ItemID.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A) Specify NULL/NOT NULL constraints for each table column.

Table Name Null constraint Not Null Constraint
Customer ReferredBy CustomerID, LastName, FirstName, EmailAddress, EncyptedPassword, City, State, ZIP, Phone
Employee OfficePhone EmployeeID, LastName, FirstName, Position, Supervisor, EmailAddress
Vendor Fax VendorID, CompanyName, ContactLastName, ContactFirstName,Address, City, State, ZIP, Phone, EmailAddress
Item PurchaseDate,ItemDescription ItemID, ItemCost, ItemPrice, VendorID
Sale - SaleID, CustomerID, EmployeeID, SaleDate, SubTotal, Tax, Total
Sale_Item - SaleID, SaleItemID, ItemID, ItemPrice

B) Specify Alternate keys, if any

Alternate Key: This is a key of table with one or more columns which can be unique but not a primary key.

Table Name Alternate Keys
Customer EmailAddress
Employee EmailAddress
Vendor EmailAddress
Item -
Sale -
Sale_Item -

C) & D) State relationships as implied by foreign keys, and specify the maximum and minimum cardinality of each relationship. Justify your choices.

Explain how you will enforce the minimum cardinalities in your answer to part C. Use referential integrity actions for required parents, if any.

Cardinality: Express the number of entities to with another entity can be associated via a relationship set.

These are two types:

Minimum Cardinality & Maximum Cardinality:

Minimum cardinality is the minimum count of instances of an entity that are related with each instance of another entity. Maximum cardinality is the maximum number of instances of an entity that are related with each instance of another entity.

Table Name Primary Key Foreign Key Minimum Cardinality Maximum Cardinality Justification
Customer CustomerID - - - Parent tables - No Foreign key is needed
Employee EmployeeID - - - Parent tables - No Foreign key is needed
Vendor VendorID - - - Parent tables - No Foreign key is needed
Item ItemID VendorID mandatory-mandatory many-one Many items can have single vendor
Sale SaleID CustomerID, EmployeeID mandatory-mandatory one-one one sale id can contain only one emp id and cust id
Sale_Item SaleItemID SaleID, ItemID mandatory-mandatory one-many one sale item can have many one sale ID and multiple ID
Add a comment
Know the answer?
Add Answer to:
Assume that The Queen Anne Curiosity Shop designs a database with the following tables. CUSTOMER (CustomerID,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assume that Garden Glory designs a database with the following tables: OWNER (OwnerID, OwnerName, OwnerEmailAddress, OwnerType)...

    Assume that Garden Glory designs a database with the following tables: OWNER (OwnerID, OwnerName, OwnerEmailAddress, OwnerType) OWNED_PROPERTY (PropertyID, PropertyName, PropertyType, Street, City, State, Zip, OwnerID) GG_SERVICE (ServiceID, ServiceDescription, CostPerHour); EMPLOYEE (EmployeeID, LastName, FirstName, CellPhone, ExperienceLevel) PROPERTY_SERVICE (PropertyServiceID, PropertyID, ServiceID, ServiceDate, EmployeeID, HoursWorked) The referential integrity constraints are: OwnerID in OWNED_PROPERTY must exist in OwnerID in OWNER PropertyID in PROPERTY_SERVICE must exist in PropertyID in OWNED_ PROPERTY ServiceID in PROPERTY_SERVICE must exist in ServiceID in GG_SERVICE EmployeeID in PROPERTY_SERVICE must exist...

  • For this set of Review Questions, we will create and use a database for the Wedgewood...

    For this set of Review Questions, we will create and use a database for the Wedgewood Pacific Corporation (WPC) that is similar to the Microsoft Access database we created and used in Chapters 1 and 2. Founded in 1957 in Seattle, Washington, WPC has grown into an internationally recognized organization. The company is located in two buildings. One building houses the Administration, Accounting, Finance, and Human Resources departments, and the second houses the Production, Marketing, and Information Systems departments. The...

  • THE QUEEN ANNE CURIOSITY SHOP PROJECT QUESTIONS Figure 2-36 shows typical sales data for the Queen...

    THE QUEEN ANNE CURIOSITY SHOP PROJECT QUESTIONS Figure 2-36 shows typical sales data for the Queen Anne Curiosity Shop, and Figure 2.37 shows typical purchase data. 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. FIGURE 2-36 Sample Sales Data for the Queen Anne Curiosity Shop LastName FirstName Phone InvoiceDate Shire Robert 206-524-2433...

  • Customer (CustomerId, CustomerName) Employee (EmployeeId, EmployeeName, Salary, SupervisorId) Product(ProductId, ProductName, ListPrice) Orders (OrderId, OrderDate, CustomerId, EmployeeId,...

    Customer (CustomerId, CustomerName) Employee (EmployeeId, EmployeeName, Salary, SupervisorId) Product(ProductId, ProductName, ListPrice) Orders (OrderId, OrderDate, CustomerId, EmployeeId, Total) OrderedProduct (OrderId, ProductId, Quantity, Price) Write the code to complete the methods in OrderJDBC.java (look for TODO items). <---**IN BOLD** throughout code. /* OrderJDBC.java - A JDBC program for accessing and updating an order database on MySQL. */ import java.io.File; import java.math.BigDecimal; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; /** * An application for...

  • Garden Glory Project Questions The following Garden Glory database design is used in Chapter 3: OWNER...

    Garden Glory Project Questions The following Garden Glory database design is used in Chapter 3: OWNER (OwnerID, OwnerName, OwnerEmail, OwnerType) PROPERTY (PropertyID, PropertyName, Street, City, State, Zip, OwnerID) EMPLOYEE (EmployeeID, LastName, FirstName, CellPhone, ExperienceLevel) SERVICE (PropertyID, EmployeeID, SeviceDate, HoursWorked) The referential integrity constraints are: OwnerID in PROPERTY must exist in OwnerID in OWNER PropertyID in SERVICE must exist in PropertyID in PROPERTY EmployeeID in SERVICE must exist in EmployeeID in EMPLOYEE Garden Glory has modified the EMPLOYEE table by adding...

  • Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accoun...

    Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accounting, and employee data, and these different data sets must all be efficiently managed in order to make the data accessible. Companies rely on database engineers to ensure that their records are accurate, updated, and tracked in real time. This course covers structured query language (SQL) and how it can be used to manage database schemas, manipulate data, and analyze data. For your final...

  • need help with part b GARDEN GLORY PROJECT QUESTIONS Garden Glory wants to expand its database applications beyond the...

    need help with part b GARDEN GLORY PROJECT QUESTIONS Garden Glory wants to expand its database applications beyond the recording of property services. The company still wants to maintain data on owners, properties, employees, and services, but it wants to include other data as well. Specifically, Garden Glory wants to track equipment, how it is used during services, and equipment repairs. In addition, employees need to be trained before they use certain equipment, and management wants to be able to...

  • Questions are based on the Northwind database. a. A data dictionary (Excel file) that describes each...

    Questions are based on the Northwind database. a. A data dictionary (Excel file) that describes each of the tables. (Attached in question) b.    Write good, clean SQL that answers the following questions. c.     Separate your queries as I have done in the following example. End each query with a semicolon (;) and insert the word "go" between each query. Queries can span multiple lines if required. Select CustomerID from Customers; go Select Count(*) from Employees; go Select max(productID) from Products; 18. Produce...

  • Project Steps: 1. Database Design 1.1. Design and create a database in third normal form based...

    Project Steps: 1. Database Design 1.1. Design and create a database in third normal form based on the following requirements: • Each Job is for a specific customer and there can be more than one job per customer. • The name and address must be tracked for each customer. • Each job is described by up to 2000 characters. • Each job has a status of ‘open, ‘in process’, or ‘complete’. • Each job has a start date and end...

  • The lab for this week addresses taking a logical database design (data model) and transforming it...

    The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT