Question: IS 4 4 1 HW 7 ( SQL 3 ) ( 1 8 + 1 0 = 2 8 points total - base point still
IS HWSQL
points total base point still extra points here
Write the SQL codes needed to complete each of tasks listed below. The data are in a file called Ordermdb Run your SQL codes on the given DB and paste the query results immediately following the corresponding SQL statement: code, result; code, result.
Note: One of the tables is named Order Please note that Order is also an SQL reserved word; so the table Order, when being referred to in its full name, must be enclosed in a pair of brackets as in the form Order: pts each; : pts each
List all items that were sold for at least more than cost in the month of December. Hint: Use function MONTHdate to return the month# of a date.
List the inventory category and total quantity by each category ordered in the year in descending order of total quantity Hint: Use the function YEARdate similar to MOMTHdate
List the Spring products ordered by florists that had a list price over $
Watch: Join MANY tables!! same field name appear in multiple tables; same field name in multiple tables could mean different things!!
This problem has TWO questions List the customer ID and total orders for each customer, in descending order of total orders.Compute once for total number of orders, and once for total dollar amount so two queries
Self join:
List the employees names who are NOT in the same city as their managers, together with the names of those managers displayed in the same row as the employee Display also the employees city and the managers city for verification.
List the manager name and total sales revenue attributable to each manager.The list should be in descending order by total sales revenue.Selfjoin!
a You can FIRST solve the easier alternative: List the employees EID Name, City and their managersEID Name, City for those employees who are in the same city as their manager When you get comfortable and get the right result, then approach w the original Question
Correlated subquery:
List the item ID and description of those items whose price is higher than the average price of items in its category.
Display also the average price of the categories and name them CatAvg so the columns will be: itemID, description, listPrice, CatAvg
Hint: The same logic as today's demo List restaurants whose sales are higher than the average sales in its own city
passing a parameter from outer query into the inner query.
Display the list price, cost, and profit margin very easy to figure out right? of those products whose profit margin is higher than the average margin in its own category.
Outer join Use the Charter DB for HW
List the employee number, employee last name, and pilot license type if any for all employees. Hint: outer join, because if any some of them are not pilots
Chap P to be solved w outer join.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
