Question: You will see two databases on the Schemas panel: HAFH and ZAGI. Right click ZAGI, which will be used for this exercise, then select Set
You will see two databases on the Schemas panel: HAFH and ZAGI. Right click ZAGI, which will be used for this exercise, then select Set as Default Schema. In the Query Tab, write and execute queriers for the following query texts. To run a query, click menu Query / Execute Current Statement. After running each query, remember to take a screenshot of the MySQL Workbench window. Make sure that the code and result are shown clearly. In total, there should be six different screenshots for the query texts.
Query text 1: For the relation PRODUCT, show the columns ProductID and ProductPrice and a column showing ProductPrice plus HST (13%). (Hint: p. 25 of the slides in Ch5, query 3a)
Query text 2: Retrieve the product ID, product name, category ID, and product price for each product in the CP product category, sorted by product price in descending order. (Hint: p. 35 of the slides in Ch5, query 9)
Query text 3: For each vendor, retrieve the vendor ID and the number of products with a product price lower than $150 supplied by the vendor. (Hint: p. 49 of the slides in Ch5, query 18)
Query text 4: Consider the groups of products where each group contains the products that are from the same category, supplied by the same vendor, and whose product price is greater than $10. For each such group that has two products, retrieve the vendor ID, product category ID, number of products in the group, and average price of the products. (Hint: WHERE and HAVING commands)
Query text 5: For each product whose items were sold in one sales transaction, retrieve the product id, product name, product price, and category id. (Hint: IN command and nested queries)
Query text 6: For each line item of a sales transaction, retrieve the name of the product that was sold, quantity sold, amount charged, transaction identifier, and date of the transaction, sorted by product name. (Hint: join multiple relations)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
