Академический Документы
Профессиональный Документы
Культура Документы
18.5
18.6
Table
Primary key
Vendor
Vendor#
Employees
Employee#
Order Inventory
Purchase Order#
Receive
Inventory
Receiving Report#
Disburse Cash
Check#
Inventory
Item#
Cash
GLaccount#
Sales
Invoice#
Receive Cash
Remittance#
Customers
Customer#
Order InventoryInventory
Purchase Order#,
Item#
Sales-Inventory
Invoice#, Item#
Receive
InventoryInventory
Receiving Report#,
Item#
Quantity, condition
18.9
Accounts payable for all suppliers in Arizona
Step 1: Normally, only orders actually received are considered purchases for purposes of
calculating accounts payable. Therefore, begin with a query of the Receive
Inventory table (or M:N relationship table linking the Order Inventory and
Receive Inventory events) and the Supplier table to determine which orders have
been received this fiscal period. The supplier table is needed in order to restrict
the result to only those suppliers located in Arizona.
Step 2: Query the Order Inventory Inventory table to determine the total amount
purchased this fiscal period by summing the product of quantity ordered by its
unit cost for those purchase orders for which there is a corresponding receipt of
inventory (from step 1).
Step 3: Retrieve the total beginning balance of Accounts Payable by querying the
Suppliers table and summing the beginning balance column, restricting the sum
operation to only those suppliers located in Arizona.
Step 4: Query the Disburse Cash and Supplier tables to calculate the total amount paid to
suppliers located in Arizona this fiscal period by summing the amount column for
every row in the Disburse Cash table for which the supplier number equals the
primary key of a row in the Supplier table that has a value of Arizona in its
address column.
Step 5: Total Accounts Payable to Arizona Suppliers = Answer to Query 2 + Answer to
Query 3 Answer to Query 4.
b. Total amount of sales to a customer named Smith
Step 1: Identify all sales to Smith by writing a query that joins the Sales and Customer
tables, where the value of the customer# in the Sales table equals the primary key
in the row of the Customer table where the name = Smith.
Step 2: Sum the product of quantity sold times unit price in the M:N Sales-Inventory
table for only those rows with sales invoice numbers identified in step 1.