CIS200 Homework #7 Simple Queries

Total Page:16

File Type:pdf, Size:1020Kb

CIS200 Homework #7 Simple Queries

SP03 CIS200 QUIZ6

Name ______Seat# ______Score ______/ 40

Lab Day/Time ______Thursday 7:30am ______Friday 7:30am

Instructions:  You will have 30 minutes to complete this quiz.  Put away all books, papers, and calculators. Turn off all beepers and cell phones.  Read each question carefully and fill in the answer in the space provided. Answers must be legible or they will be marked incorrect.  When time has run out you will be told to put all pens/pencils down. Failure to do so will result in point penalization.

The tables given represent the database system for the Smith Family Fruit Company. The FRUIT table is a list of fruits that the Smith Company receives from vendors and sells to supermarkets and other types of grocery stores through distributors. The VENDORS are the companies that provide the type and quantity of fruit to the Smith Company. The RECEIPTS table includes the date and quantity of vendor fruit that is shipped from the Smith Company. The DISTRIBUTOR table lists the companies that ship the fruits from the Smith company to the supermarkets and grocery stores. The SHIP table includes the date and quantity for each fruit distributed. 1. (8 pts) Database Relationships. Set up the relationships of this database. Using the boxes below, fill in the primary key (if any) and foreign key (s) (if any) of each table and draw relationship lines between tables.

RECEIPTS table SHIP table Primary Key Primary Key

FRUIT table Foreign Key(s) Primary Key Foreign Key(s)

Foreign Key(s)

VENDORS table DISTRIBUTORS table Primary Key Primary Key

Foreign Key(s) Foreign Key(s)

2. (4 pts) Explain what happens and why if the fruitid on the FRUIT table is changed from 1 to 21.

KRQuiz#6 morn SP03 Page 1 3. (6 pts) Using the query design view below, construct a query to list, in this order, the fruit id, fruit name and vendor name for the fruits that have been shipped from the vendors to the Smith Company.

Table(s) Used ______Join type______relative to ______

Field Table Total

Show Sort

Criteria

OR

4. (4 pts) I wanted to create a list of ALL the fruits with their vendor names using only one query and it wouldn’t work. Why not?

5. (18 pts total  5, 5, and 8 respectively) Use the next three query design views to determine the quantity of each fruit that is left after having received the vendors shipments and shipped the distributors shipments. Make sure to list ALL the fruit ids, with their names, quantity of vendor shipments, quantity of distributor shipments, and the quantity of each fruit still left at the Smith Company. For instance, fruit #1, apples, received a quantity of 13 shipments from the vendor, had the distributor ship a quantity of 5 shipments, so had 8 quantities of apples still left to deliver. A negative number of quantity of each fruit that is left means that more shipments will have to be ordered from the vendor before being distributed.

Query Name: QUERY# 5A

Table(s) Used ______Join type______relative to ______

Field Table Total

Show Sort

Criteria

OR

KRQuiz#6 morn SP03 Page 2 Query Name: QUERY# 5B

Table(s) Used ______Join type______relative to ______

Field Table Total

Show Sort

Criteria

OR

Query Name: QUERY# 5C

Table(s) Used ______Join type______relative to ______

Field Table Total

Show Sort

Criteria

OR

KRQuiz#6 morn SP03 Page 3

Recommended publications