The database schema and the sample dataset have been provided in the file juicd.sql. You should...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The database schema and the sample dataset have been provided in the file juicd.sql. You should load the schema and the data into your own server, and then use MySQL Workbench to get the structure diagram for the schema. Post to the Discussion Board in the unit Blackboard for guidance if there is any ambiguity in how to interpret the questions. Basic queries (8 marks) Place all 10 queries into a single text file with the name basic.sql so that they can be automatically run by a script. These queries are all single SQL queries that require nothing more than joins and elementary use of the aggregate functions with GROUP BY. All students should be able to write queries at this level for the exam. . . ● What SQL query will produce the row of customer information for the customer with Juicd card number 1000? What SQL query will determine the total number of orders in the database (the output should be a scalar)? What SQL query will list the names and addresses of the outlet managers? (The tablemanages contains information about managers.) What SQL query will list the names and addresses of the employees who work full- time at a single Juicd store? What SQL query will list the names, addresses and total working percentage of all Juicd employees (so someone who works 50% at one store and 25% at another store works a total of 75% of their time). Only include employees that are currently working (i.e. appear in the worksAt table). What query will produce a table listing the minimum, maximum and average number of Juicd points outstanding? What SQL query will list each line manager (by name) together with the number of employees they supervise? (supervision is in the lineMgr table)? What SQL query will list the address of each outlet, together with the total number of orders that they have served? Each cup of juice is represented by a row in the Juice Cup table which stores the cup Idand the size of the cup. The actual juices that make up each cup of juice are stored in the table comprises which lists the juices and their percentages. For example, SELECT * FROM comprises WHERE cupid = 1000 tells us that this cup of juice is 40% Juice #7, 40% of Juice # 8 and 20 % of Juice # 20; ● ● What SQL command will determine the price in cents of the JuiceCup with cupld 1000? (The table Juice contains the price in cents-per-ml of each juice). More complex queries (6 marks) These queries are more complex than the basic SQL queries and may involve more exotic join conditions, such as outer joins, subqueries and simple stored procedures or functions. What SQL query will list the actual juices by name and their percentages for this particular juice cup (i.e. the juice with cupId 1000)? Place all queries and function definitions into a single text file with the name complex.sql so that they can be automatically run by a script. . What SQL query will list the total number of customer orders per outlet (listed by outlet address) per day of the week? (In other words, Outlet 1s orders on Mondays, Tuesdays etc.) What SQL query will list the cup ids of all the JuiceCup that use more than three different ingredients? (You may assume that each row of comprises for a given Juice Cup is actually a different ingredient.) What single SQL query will list the names and addresses of all Juicd employees who are not working at any of the outlets at the moment? What SQL query will list all the customer orders (by orderId) that consist only of juices (no non-juice items)? A stored function is similar to a stored procedure, except that it returns a value that can be used in a SQL statement just like the other SQL functions. See this Stored Function Tutorial for some more details on how to declare the function and return the values (ignore the DETERMINISTIC keyword). ● 1 Write a function juice CupCost (id INT) RETURNS DOUBLE that will be called with the id of a Juice Cup and then return the cost (in cents) of that particular JuiceCup. For example, Juice Cup 10 is a 400ml juice that is a 50-50 mixture of raspberry-pear, and it costs $3.40. mysql> select juiceCupCost (10); +- ---+ I juiceCupCost (10) | ---+ 340 I Write a function juiceOrderCost (id INT) RETURNS DOUBLE that returns the total price of the juice-component of an order. Obviously this function should use your previous function for the cost of each individual JuiceCup. Additional functionality (6 marks) Place all queries and view/procedure definitions into a single text file with the name additional.sql so that they can be automatically run by a script. Write a stored function totalOrderCost (id INT) RETURNS DOUBLE that returns the total cost (in cents) of the order with order number id. (You should use your previous functions, so make sure you test them well!) Create a view Customer PricedOrder with columns date DATE, customerId INT, orderId INT and orderCost DOUBLE that provides a more accessible way for the DB user to run queries regarding customer orders. (The columns have their natural meanings) highest spending each Juicd runs a Customer Of The Month promotion, and sends coupons and other rewards to the customer month. Write a stored procedure list CofM () that creates a table customerOfMonth (year INT, month TEXT, COfM INT, cOfMemail TEXT) that lists for each year and month (given as "January", "February" etc) the customer number and email of the biggest spender for that month (you may ignore the possibility that there may be joint winners). The database schema and the sample dataset have been provided in the file juicd.sql. You should load the schema and the data into your own server, and then use MySQL Workbench to get the structure diagram for the schema. Post to the Discussion Board in the unit Blackboard for guidance if there is any ambiguity in how to interpret the questions. Basic queries (8 marks) Place all 10 queries into a single text file with the name basic.sql so that they can be automatically run by a script. These queries are all single SQL queries that require nothing more than joins and elementary use of the aggregate functions with GROUP BY. All students should be able to write queries at this level for the exam. . . ● What SQL query will produce the row of customer information for the customer with Juicd card number 1000? What SQL query will determine the total number of orders in the database (the output should be a scalar)? What SQL query will list the names and addresses of the outlet managers? (The tablemanages contains information about managers.) What SQL query will list the names and addresses of the employees who work full- time at a single Juicd store? What SQL query will list the names, addresses and total working percentage of all Juicd employees (so someone who works 50% at one store and 25% at another store works a total of 75% of their time). Only include employees that are currently working (i.e. appear in the worksAt table). What query will produce a table listing the minimum, maximum and average number of Juicd points outstanding? What SQL query will list each line manager (by name) together with the number of employees they supervise? (supervision is in the lineMgr table)? What SQL query will list the address of each outlet, together with the total number of orders that they have served? Each cup of juice is represented by a row in the Juice Cup table which stores the cup Idand the size of the cup. The actual juices that make up each cup of juice are stored in the table comprises which lists the juices and their percentages. For example, SELECT * FROM comprises WHERE cupid = 1000 tells us that this cup of juice is 40% Juice #7, 40% of Juice # 8 and 20 % of Juice # 20; ● ● What SQL command will determine the price in cents of the JuiceCup with cupld 1000? (The table Juice contains the price in cents-per-ml of each juice). More complex queries (6 marks) These queries are more complex than the basic SQL queries and may involve more exotic join conditions, such as outer joins, subqueries and simple stored procedures or functions. What SQL query will list the actual juices by name and their percentages for this particular juice cup (i.e. the juice with cupId 1000)? Place all queries and function definitions into a single text file with the name complex.sql so that they can be automatically run by a script. . What SQL query will list the total number of customer orders per outlet (listed by outlet address) per day of the week? (In other words, Outlet 1s orders on Mondays, Tuesdays etc.) What SQL query will list the cup ids of all the JuiceCup that use more than three different ingredients? (You may assume that each row of comprises for a given Juice Cup is actually a different ingredient.) What single SQL query will list the names and addresses of all Juicd employees who are not working at any of the outlets at the moment? What SQL query will list all the customer orders (by orderId) that consist only of juices (no non-juice items)? A stored function is similar to a stored procedure, except that it returns a value that can be used in a SQL statement just like the other SQL functions. See this Stored Function Tutorial for some more details on how to declare the function and return the values (ignore the DETERMINISTIC keyword). ● 1 Write a function juice CupCost (id INT) RETURNS DOUBLE that will be called with the id of a Juice Cup and then return the cost (in cents) of that particular JuiceCup. For example, Juice Cup 10 is a 400ml juice that is a 50-50 mixture of raspberry-pear, and it costs $3.40. mysql> select juiceCupCost (10); +- ---+ I juiceCupCost (10) | ---+ 340 I Write a function juiceOrderCost (id INT) RETURNS DOUBLE that returns the total price of the juice-component of an order. Obviously this function should use your previous function for the cost of each individual JuiceCup. Additional functionality (6 marks) Place all queries and view/procedure definitions into a single text file with the name additional.sql so that they can be automatically run by a script. Write a stored function totalOrderCost (id INT) RETURNS DOUBLE that returns the total cost (in cents) of the order with order number id. (You should use your previous functions, so make sure you test them well!) Create a view Customer PricedOrder with columns date DATE, customerId INT, orderId INT and orderCost DOUBLE that provides a more accessible way for the DB user to run queries regarding customer orders. (The columns have their natural meanings) highest spending each Juicd runs a Customer Of The Month promotion, and sends coupons and other rewards to the customer month. Write a stored procedure list CofM () that creates a table customerOfMonth (year INT, month TEXT, COfM INT, cOfMemail TEXT) that lists for each year and month (given as "January", "February" etc) the customer number and email of the biggest spender for that month (you may ignore the possibility that there may be joint winners).
Expert Answer:
Answer rating: 100% (QA)
1 select from customer where jcardnum 1000 2 select count from customerorder 3 select ... View the full answer
Related Book For
Integrated Accounting
ISBN: 978-1285462721
8th edition
Authors: Dale A. Klooster, Warren Allen, Glenn Owen
Posted Date:
Students also viewed these accounting questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
Read the following production planning paper and summarize it: Introduction A good production plan is the foundation of success in any production firm. Production planning is a rather complicated...
-
Consider the pistoncylinder arrangement shown in the sketch below. The gas forces on each side of the piston, assuming there are no frictional forces at the pistoncylinder interface, balance the...
-
Eight work centers must be arranged in an L- shaped building. The locations of centers 1 and 3 are assigned as shown in the accompanying diagram. Assuming transportation costs are $ 1 per load per...
-
The accompanying figure shows a circle of radius r with a chord of length 2 and an arc s of length 3. Use Newtons method to solve for r and (radians) to four decimal places. Assume 0 < < . 0 2 S = 3
-
The probability that a construction company will get the tender for constructing a flyover is 0.33, the probability that it will get the tender for constructing an underpass is 0.28, and the...
-
Multiple-Choice Questions 1. The key difference between residual income and economic value added is that EVA a. Uses the actual cost of capital for the company rather than a minimum required cost of...
-
1. Compute cost of goods manufactured.
-
a. Identify the physical control weaknesses depicted in the flowchart for Problem 2. INTERNAL CONTROLS AND FLOWCHART ANALYSIS b. Describe the IT controls that should be in place in thissystem. Sales...
-
8. Assume a random sample of three paired observations on two variables (X and Y) provided the following data. X Y 326 11 16 12 (10) a. Manually calculate the variance and standard deviation of X and...
-
Sanderson Mart ran an advertisement in the Daily Tribune that stated, Special offer to our customers3/8-inch Electric Hand Drills, Saturday only $14.99, only 100 in stock, while they last! Be here...
-
Indicate whether each of the following statements is true or false by writing T or F i n t he a nswer c olumn. A contract resulting from the use of undue infl uence is voidable at the option of the...
-
Indicate whether each of the following statements is true or false by writing T or F i n t he a nswer c olumn. A contract of adhesion is characterized by unequal bargaining power of the parties.
-
Indicate whether each of the following statements is true or false by writing T or F i n t he a nswer c olumn. Intentional concealment of material facts is just as fraudulent as making false...
-
Rural Telephone Service Company was a public utility providing telephone service to several communities in Kansas. Rural published a typical telephone directory, consisting of white pages and yellow...
-
Sammy owns an accounting firm that is funded entirely by her and has 66 employees. She has a single office in one city. In this case, Sammy's firm can best be described as a _____. government...
-
Frontland Advertising creates, plans, and handles advertising campaigns in a three-state area. Recently, Frontland had to replace an inexperienced office worker in charge of bookkeeping because of...
-
Create the following 6 financial analysis reports for Casey Corporation and provide an analysis as requested: a. Income Statement (Horizontal) report with a run date of 12/31/. Provide a narrative...
-
If the statement is true, write a T in the space provided. If the statement is false, write F in the space provided. An entry to add a new account is entered in the General Journal window.
-
If the statement is true, write T in the space provided. If the statement is false, write F in the space provided. 1. The depreciation rate for the double-declining-balance method is twice the...
-
The following is the trial balance of Sangeeta Udhyog Ltd. as on 31st March 2006. Further information 1.The authorised share capital of the company consists of 4,00,000 equity shares of ` 10 each. 2....
-
The accountant of Pushpa Engineering Company Ltd. has prepared the following trial balance of the company as on 31st March, 2006. Further information 1. Authorised equity share capital of the company...
-
Following trial balance as at 31st March 2006 has been prepared from the account books of Mahesh Foods Ltd. Further information 1.The authorized capital of the company is 3 lac equity shares of ` 10...
Study smarter with the SolutionInn App