Question

There are 7 problems that require using joins. Each problem has 10 points. 1. Write an...

There are 7 problems that require using joins.

Each problem has 10 points.
1. Write an SQL command that will find any customers who have not placed orders and sort them out by CustomerID in ascending order.

2. List the employees and supervisors names for each supervisor who supervises more than two employees.

3. List the name of each employee, his or her birth date, the name of his or her manager, and the manager’s birth date for those employees who were born before their manager was born; label the manager’s data Manager and ManagerBirth.

4. Write an SQL command to display the order number, customer number, order date, and items ordered sorted by order date from low to high for some particular customer.

5. Write an SQL command to display each item ordered for order number 1, its standard price, and the total price for each item ordered sorted from low to high by total price.

6. Write an SQL command to total the cost of order number 1.

7. Calculate the total raw material cost (label TotCost) for each product compared to its standard product price. Display product ID, product description, standard price, and the total cost in the result. Order by ProductId ascending.

The questions in about quaries using sql

PVFC database

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SQL Commands:

(1) SELECT CustomersID

FROM Customers

WHERE CustomersID NOT IN(SELECT OrderID

FROM Customers)

ORDER BY CustomersID ASC;

(2) SELECT EmployeeName,SupervisorName,SupervisorID AS SID

FROM Employee

WHERE COUNT(DISTINCT EmployeeID) >2 AND SupervisorID =SID;

(3) SELECT EmployeeName,EmpBirthDate,ManagerName AS Manager,ManagerBirthDate AS ManagerBirth

FROM Employee
WHERE EmpBirthDate < ManagerBirthDate

(4) SELECT OrderNumber,CustomerNumber,OrderDate,ItemOrdered

FROM SalesItem

WHERE CustomerID =ANY (SELECT CustomerID  

FROM SalesItem

WHERE OrderDate IS NOT NULL)

ORDER BY OrderDate ASC;

(5) SELECT ItemOrder,Prize,SUM(Prize)

FROM SalesItem

WHERE OrderNumber=1

ORDER BY Prize ASC;

(6) SELECT SUM(Cost)

FROM SalesItem

WHERE OrderNumber=1;

(7) SELECT ProductID,productDescription,standprize,SUM(Cost) AS TotCost

FROM SalesItem
WHERE Cost<StandardPrize

GROUP BY ProductID,productDescription,standprize

ORDER BY ProductID ASC;

Add a comment
Know the answer?
Add Answer to:
There are 7 problems that require using joins. Each problem has 10 points. 1. Write an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top o...

    If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top of each page. Also, using a 12-point font, include the SQL statement and then provide a screen shot of each query. The screen shots must include both the SQL statement and the results for each item below based on the data entered in...

  • Write a SQL query that shows the price of each order made by customers whose last name starts wit...

    Write a SQL query that shows the price of each order made by customers whose last name starts with the letter M. Display the order number, the last name on the order, and the price of the order (Order Price). Show the results with the highest order price first. Write a SQL query that determines the most expensive item purchased in each order (Item Price). Display the order number, the date of the order, the last name of the customer...

  • 7. Using the provided schema of a Purchase Order Administration database, write the following queries in...

    7. Using the provided schema of a Purchase Order Administration database, write the following queries in SQL. (In the schema, bold attributes are primary keys and italicized attributes are foreign keys.) SUPPLIER (SUPNR, SUPNAME, SUPADDRESS, SUPCITY, SUPSTATUS) SUPPLIES (SUPNR, PRODNR, PURCHASE_PRICE, DELIV_PERIOD) PRODUCT (PRODNR, PRODNAME, PRODTYPE, AVAILABLE_QUANTITY) PO_LINE (PONR, PRODNR, QUANTITY) PURCHASE_ORDER (PONR, PODATE, SUPNR) 7d) Write a nested SQL query to retrieve the supplier number, supplier name, and supplier status of each supplier who has a higher supplier status...

  • I can provide my log in to my teradata database if necessary. Thanks 19:31 P B...

    I can provide my log in to my teradata database if necessary. Thanks 19:31 P B . Ch. 6 HW Assignment 4 - Saved SG 59% Make db_pvfc11_big as your default database when you log into SQL Assistant: Username userid Password: Default Database: db pufc11_big Database Descriptions Provide proof of ownership by using Current_User attribute in all SELECT statements. Use the PVFC database to answer the following questions: 1. For each customer, list the CustomerID and the total number of...

  • Write just one SQL statement per question 1. Display Publisher ID, Publisher Name and Total Number...

    Write just one SQL statement per question 1. Display Publisher ID, Publisher Name and Total Number of Books published by each publisher. 2. List Publisher ID, Publisher Name, Title and price of the highest priced book. 3. List Order ID, Customer ID, Order Date, and Number of Items in each order. Order the data by Customer ID in ascending (A – Z) order. 4. Display Title, Category and Profit for each book in the children and computer category. 5. Display...

  • Create the following SQL Server queries that access the Northwind database Same as problem 3 but,...

    Create the following SQL Server queries that access the Northwind database Same as problem 3 but, limit the list to all customers who placed 3 or more orders. The product id, product name, last date that the product was ordered for all items in the Grains/Cereals category. (Hint: Use MAX) The product ID, product name, and number of distinct customers who ordered that product in 1996 Thank you. Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...

  • pls help me with these SQL questions Here are tables TEAM table Task 10 (4 marks)...

    pls help me with these SQL questions Here are tables TEAM table Task 10 (4 marks) Write an SQL statement to display fan categories, the number of tickets in each category the fan bought (change the alias to "NUMBER OF TICKETS PURCHASED") along with the sum of prices (change the alias to TOTAL PRICES') in each category the fans paid. Sort the result by total price in an ascending order. Task 11 (5 marks) Write an SQL statement to display...

  • An online company sells hundreds of office supply products on its e-Commerce store. It has asked...

    An online company sells hundreds of office supply products on its e-Commerce store. It has asked you to design and implement a sales order processing system which will be used by users in our Operations department to process sales orders. Here is an overview of the sales order process. Customers make purchases by placing orders. Each customer has a customer number and profile (such as name, shipping address). To simplify the matter, each time an order is placed, only one...

  • Use SQL to slove the problem 1. (7) List all condos in building C, the date...

    Use SQL to slove the problem 1. (7) List all condos in building C, the date they were cleaned, and the full name of the staff who cleaned them in August. 2. (5) Display the activities reserved in June for more than 3 people. Include the activity description and label the output as Activities Reserved in June. 3. (4) Listing for all guides and their certification renewal dates for next year. Include full name and hire date. 4. (6) Management...

  • All code will be in Java, and there will be TWO source code. I. Write the...

    All code will be in Java, and there will be TWO source code. I. Write the class  MailOrder to provide the following functions: At this point of the class, since we have not gone through object-oriented programming and method calling in detail yet, the basic requirement in this homework is process-oriented programming with all the code inside method processOrderof this class. Inside method processOrder, we still follow the principles of structured programming.   Set up one one-dimensional array for each field: product...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT