讲解:CS348、SQL、PL/SQL、SQLR|Haskell

CS348 - Fall 2018 - Project 2PL/SQLDue: Tuesday, November 6, 2018 at 11:59PM on Blackboard(There will be a 10% penalty for each late calendar day. After five calendar days, the homeworkwill not be accepted.)In this project, you are asked to complete 5 procedures with PL/SQL. PL/SQL is only covered inthe PSOs not in the class lectures.Notes:1. The schema definition of database tables and sample test data are provided in tables.sqland data.sql respectively. You need to use droptables.sql to clean your database beforeyou start this project because test data may be different from the data used in project 1.2. You should finish all your work in answer.sql. Skeleton code for procedures is alreadyprovided in answer.sql. Oracle will give error messages if you don’t finish all of them, soyou can comment the unfinished ones during development.3. Please, don’t change the names of procedures in answer.sql.4. You can assume that all possible input to procedures 1-4 will be legal input, but we willtest illegal input in procedure 5. So, the exception block is not required for testingprocedures 1-4. Please, refer to the requirement of procedure 5 for details.5. Submit your answer via BlackBoard.6. Hints: you may want to use the command “show errors;” to debug your procedures.The detailed requirements of each procedure are listed below:1. RetailerDetailCreate a procedure that shows the detailed information of a specific retailer, given theRetailerId as input. The detailed information should include the following:a. Retailer Nameb. Retailer Addressc. Retailer total orders in Orders table.d. Most popular product and the amount sold in the Orders table. We define the mostpopular product as the one having the highest number of items sold in the Orderstable. You can assume there is only one most popular product.The output should be in the following format:Retailer Name: Retailer ARetailer Address: r_ddress1Retailer Total Orders: 7Most Popular Product: infernoTotal Sold: 1152. MonthlyDelayReportCreate a procedure that can generate a simple report for the delayed orders of all monthsin the database. For each month, you need to list the total number of delayed orders andthe retailers that have delayed orders in that month. Only display the months with delayedorders. The ordering of months should be CS348留学生作业代做、代写SQL程序设计作业、代做PL/SQL作业、SQL语言作业代写代做 代写R语言程序|帮做Hafrom the earliest to the lastest, while the orderingof retailers should be by retailer’s name.The output should be in the following format:Delayed orders in 2018-1: 2Retailers with delayed orders:- Retailer ADelayed orders in 2018-2: 2Retailers with delayed orders:- Retailer A- Retailer BDelayed orders in 2018-5: 1Retailers with delayed orders:- Retailer ADelayed orders in 2018-6: 1Retailers with delayed orders:- Retailer B3. LeastProfitProductCreate a procedure that can generate a simple report for the products with least averageprofit in each category. Here, we define the profit of a product as the average of(Orders.UnitPrice - Products.ExfactoryPrice), given the product appears in differentorders. Notice that there may be more than one product with the same average profit.Display all the products names and their profit for all categories.The output should be in the following format:Least Profit in electronics- Pixel Book: 75Least Profit in books- Foundation of Crypto: 30- da vinci code: 30Least Profit in apparel- Adidas cap: 11Least Profit in text_books- inferno: 304. RetailerProductCatergoryCreate a table called RetailerCatergoryTable, with the most recent information about howmany orders of each retailer are for products in the categories: electronic, apparel andbooks respectively.The output after running “select * from RetailerCatergoryTable;” should look like:RETAILERID ELECTRONIC APPAREL BOOKS---------- ---------- ---------- ---------- 1 1 1 2 2 4 0 0 3 0 1 0 4 1 0 0 5 1 0 05. CustomerProductInfoGiven a customer id and a product id as input, list all order dates in which the customerorders the product. You may need to use Exception in PL/SQL to prevent your procedurefrom crashing if given an invalid customer id or an invalid product id.The output of a valid input should be similar to:Records of customer id 1 with product id 1:OrderDate: 01-JAN-18The output of invalid inputs should be similar to:Records of customer id -1 with product id 1:Invalid customer id or product id!Records of customer id 1 with product id -1:Invalid customer id or product id!Records of customer id 100 with product id 100:Invalid customer id or product id!(If there is no customer id 100 or product id 100 in database)转自:http://ass.3daixie.com/2018110722443860.html

你可能感兴趣的:(讲解:CS348、SQL、PL/SQL、SQLR|Haskell)