Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 3 Lab1 Review on Database Dina A. Said

Similar presentations


Presentation on theme: "Week 3 Lab1 Review on Database Dina A. Said"— Presentation transcript:

1 Week 3 Lab1 Review on Database Dina A. Said dasaid@ucalgary.ca

2 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

3 Review for Lab Quiz #2  Create a new database named Stuff.

4 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?

5 Review for Lab Quiz #2  Create a table called Products with the fields ProductID, PName, PurchaseDate, Supplier and PurchasePricePerPiece.  What relationships might be required?

6 Review for Lab Quiz #2  Set the default quantity in the Orders table to 0.

7 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

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 110089John Smith211/1/20095 210769Lora Bill112/1/200910 310768Sandra smith105/1/20099 410768John Smith52/1/20095

9 Review for Lab Quiz #2  Create a query named query_1 that displays all the information in products table.

10 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".

11 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

12 Review for Lab Quiz #2  In query_4, create a new field called RevenueAmount. This should be calculated by Quantity*SellingPricePerPiece.

13 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.

14 Review for Lab Quiz #2  Create a report of query_4.

15 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.


Download ppt "Week 3 Lab1 Review on Database Dina A. Said"

Similar presentations


Ads by Google