Week 3 Lab1 Review on Database Dina A. Said
Next Week (T1 & T2 only) Next Monday Lab Quiz #2 on Databases Current Wednesday “Week 1 Lab 2” of Problem Solving Thanks for TA Paul for Today slides
Review for Lab Quiz #2 Create a new database named Stuff.
Review for Lab Quiz #2 Create a table called Orders with the fields: OrderID, ProductID, SalespersonName, SalesDate, Quantity and SellingPricePerPiece. What is the primary key? Data type for ProductID? Data type for SalespersonName? Data type for SalesDate?
Review for Lab Quiz #2 Create a table called Products with the fields ProductID, PName, PurchaseDate, Supplier and PurchasePricePerPiece. What relationships might be required?
Review for Lab Quiz #2 Set the default quantity in the Orders table to 0.
Review for Lab Quiz #2 Add the following records to the products table: ProductID: 10089, PName: Bath Salts, PurchaseDate: 10/20/2008, Supplier: Bath and Beyond, PurchasePricePerPiece: $2 ProductID: 10768, PName: Shower Gel, PurchaseDate: 10/1/2008, Supplier: Lush, PurchasePricePerPiece: $4.50 ProductID: 10769, PName: Shampoo, PurchaseDate: 10/1/2007, Supplier: Lush, PurchasePricePerPiece: $8
Review for Lab Quiz #2 Add the following data to the orders table: 1/21/2009CPSC203- Week2- Lab18 orders orderIDproductID salesManNa me quantityorderDate sellingPriceP erPiece John Smith211/1/ Lora Bill112/1/ Sandra smith105/1/ John Smith52/1/20095
Review for Lab Quiz #2 Create a query named query_1 that displays all the information in products table.
Review for Lab Quiz #2 Create a query named query_2, using query_1, that displays all fields in both tables, but limit the query to the Supplier "Lush".
Review for Lab Quiz #2 Create an aggregate query (make sure the Totals button is selected) named query_3. Group the query using SalesPersonName and calculate the Average quantity he/she sells
Review for Lab Quiz #2 In query_4, create a new field called RevenueAmount. This should be calculated by Quantity*SellingPricePerPiece.
Review for Lab Quiz #2 In query_4, create a new field called Status. This should display "Profit" if SellingPricePerPiece>PurchasePricePerPiece, "Breakeven" if they were equal and "Loss" otherwise.
Review for Lab Quiz #2 Create a report of query_4.
Review for Lab Quiz #2 Create a crosstab query from query_1. Let the rows show the SalesPersonName, the columns show the product name, and calculate the sum of Quantity.