Question
SQL queries 1) List product numbers, product names, and product line numbers for all products that have a profit margin (difference between product price and
SQL queries
1) List product numbers, product names, and product line numbers for all products that have a profit margin (difference between product price and product cost) of at least $150 per unit and for which the company has at least 500 units in stock. Sort the products by product line number and by product name within each product line (both ascending).
2) Provide a list of customer industry codes with, for each industry code, the sum of customer annual goals, the average goal, minimum goal, and maximum goal. Sort the list by the total of customer annual goals in the descending order.
3) List the name of the department, the name of the department manager (in the format ), department phone, and department building for each department the name of which includes the word "general" (in any form of capitalization).
4) For each department, list the name of the department, the number of employees reporting to the department, the total and average number of customers for whom the department's employees are responsible, and the total annual goal for the customers for whom the department's employees are responsible for. Sort the answers by the number of employees reporting to the department.
5) For each product, list product name, product line name, the total amount of sales last year, the total amount of sales year to date, and the percentage change of sales from last year to this year. Include only those products for which the decline in sales is more than 50% or the increase in sales is more than 50%.
6) Using a subquery to select the subset of employees defined below, list the employee name, employee's number of years at CompProducts (with two decimals) and the names of the customers whom the employee serves. Include only employees who have worked at CompProducts for more than 25 years (but all of them)
7) List the name of the customer group, the name of the product, the total amount of sales for the customer group-product pair, average sales per customer, and the number of customers within the customer group to whom the product has been sold. Include only the customer groups that have the word "east" in their name (in any form of capitalization). Sort the results by customer group name and product name.
8) List the number and name of all the vendors that have annual sales (using the vendor_annual_sales column) at least double the average annual sales of all the vendors located in the vendor's state. Bonus (+5): include in the SELECT clause the average sales within the vendor's own state and the vendor's annual sales.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started