Question
For each query, show your SQL statement and SCREENSHOT of TOP 10 tuples (if there are more than 10 tuples in the answer) using SELECT
For each query, show your SQL statement and SCREENSHOT of TOP 10 tuples (if there are more than 10 tuples in the answer) using SELECT TOP 10 . You SQL queries must be generic such that if contents of tables change, your queries would yield different set of answers, still satisfying the conditions of the questions.
Use the MS Northwind sample database
1. Retrieve the first names of both employee and his/her manager such that managers first name is NOT Andrew. For subordinates whose manager has the first name Andrew, still show the subordinates first names, along with NULL values for their managers first names.
2. How many orders has each employee handled? Show employee ID and # of orders.
3. Retrieve all employee names who live in USA but are not a Sales Representative (You must use set operators to solve this question).
4. Retrieve all products ordered by the customer 'Island Trading'.
5. Retrieve all products, and their suppliers, who have inventory level < 10 and have been ordered after 1/1/1998.
6. How many customers are handled by employees who are located in the same city as customers are?
7. Find products with the highest unit price. Show the name and unit price of products.
8. For each region of UK, and for each city within each region, find out how many orders have been shipped.
9. Among products supplied from London, find the one with the highest unit price, and show the product name and unit price.
10. For each manager with >= 2 subordinates, find out the number of subordinates. Show the employeeID of such managers and the number of his/her subordinates.
11. Find out the freight and its shipped postal code of the lightest freight.
12. Retrieve the distinct name of USA customers in reverse alphabetical order who bought a product called Chai.
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