Question

Saul wants to buy a new writer's desk, but he doesn't want to spend more than...

  1. Saul wants to buy a new writer's desk, but he doesn't want to spend more than $350. Write a select statement to find products matching these requirements
  2. For each customer, list the customer name and city and state in this format: City, State (one column)
  1. Display only those orders where more than one different product has been ordered
  1. Find the average price of bookcases
  1. A. List all the customers and list the number of different shipping addresses for each. Customers with more shipping addresses should appear at the top.
    B. Now list only customers with 2 or more locations
  1. A. How many different materials are needed to assemble an Oak Computer Desk
    B. Find the total dollar amount in materials required to assemble an Oak Computer Desk
  1. Report the OrderID and OrderDate for all orders for Salespersons from New York
    A. use a join
    B. Use a noncorrelated Subquery
    C. use a correlated subquery
    D. use where exists
  2. Report the ID and Name of employees (managers) who are managing employees with more than one skill
  1. Find the names of all the customers who have purchased items from either the Antique or Classical lines.
    a. Use a set operator (UNION, INTERSECT, OR MINUS)
    b. Do not use a set operator (UNION, INTERSECT, OR MINUS)
  1. List the order id for all orders where the customer has purchased both a product from the Antique and Modern lines in the same order
    a. Use a set operator (UNION, INTERSECT, OR MINUS)
    b. Do not use a set operator (UNION, INTERSECT, OR MINUS)
  1. Functions:
    a. Create a function that has the Customer_id as input and returns a number that represents the total cost of orders for this customer. Notice that you will need to multiply the Order_Qty from table order_details and the Unit_Price from table items to get the total cost of each order.
    b. Now use the function: Write a select statement that selects all the customers and the total cost of the orders they have ever made.
  1. Procedure:
    a. Write a procedure that has as input the customer_id. Then the procedure should delete the corresponding customer from table customers.
    b. Notice that customer_id is a foreign key on table orders. Therefore, the customer cannot be deleted if he has placed orders. To delete a record from customers you should first delete the corresponding orders and to do that you need to first delete the corresponding order_details.
    c. Now execute the procedure to delete customer with id 1. If you have solved part 01 a record will be inserted into Customer_Archives.
    d. ROLLBACK; and all these changes will be undone!

Homework Answers

Answer #1

Answering first four subparts. For others, please create seperate question.

Kindly upvote if this helped you.

Q1 -
Saul wants to buy a new writer's desk, but he doesn't want to spend more than $350. Write a select statement to find products matching these requirements

A1 - SELECT * FROM <table_name> WHERE PROD_TYPE = 'DESK' AND cost<='350';
- Assumption made
- Please give table name as per the statement. This is just a template
- The relation/table has a column called PROD_TYPE and its value is 'DESK' for desk products
- The relation/table has a column called cost which tells the cost of the item.


Q2 - For each customer, list the customer name and city and state in this format: City, State (one column)

A2 - SELECT CONCAT(CITY,",",STATE) , NAME FROM <table_name>;
- Assumption made
- Please give table name as per the statement. This is just a template
- The relation/table has a column called NAME and its value is customers name


Q3 - Display only those orders where more than one different product has been ordered

A3 -  
SELECT ORDER_ID, COUNT(DISTINCT PROD_ID) as count FROM <customer_table> AS C
INNER JOIN <orders_table> AS O ON C.customer_ID = O.customer_ID
GROUP BY C.customer_ID, customer_name
HAVING COUNT(DISTINCT PROD_ID) > 1

- Assumption made
- Please give table name as per the statement. This is just a template
- There are two tables customer and orders. Order info we have in customer table and the corresponding products in the orders we have in prod table. We are joining the tables and based on distinct prod id, we are saying that particular order has different products.



Q4 - Find the average price of bookcases

A4 - SELECT AVG(BOOKCASES) FROM <table_name>;

- Assumption made
- Please give table name as per the statement. This is just a template
- The relation/table has a column called BOOKCASES and its value is price of bookcase

Know the answer?
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
Similar Questions
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1....
Class-In Assignment 3: Chapters 4&5 How to retrieve data from two or more tables Exercises 1. Write a SELECT statement that returns all columns from the Vendors table inner-joined with all columns from the Invoices table. 2. Write a SELECT statement that returns four columns: vendor_name vendor_name from the Vendors table invoice_number invoice_number from the Invoices table invoice_date invoice_date from the Invoices table balance_due invoice_total minus payment_total minus credit_total from the Invoices table The result set should have one row...
Question 1 of 15 Linsay’s Landscaping wants to make notes in QuickBooks each time she services...
Question 1 of 15 Linsay’s Landscaping wants to make notes in QuickBooks each time she services a client to streamline the invoicing process at the end of the month. She does not want these records to affect any month or year to date financial reports throughout the month until she invoices the client. Which of the following transaction types do you recommend she uses to achieve this goal? A. Invoice B. Credit Memo C. Sales Receipt D. Delayed Charge E....
      MK Restaurant: Branding of Thai-Style Hotpot The restaurant industry is one of the most...
      MK Restaurant: Branding of Thai-Style Hotpot The restaurant industry is one of the most competitive in Thailand. With a large number of players ranging from restaurants in five-star hotels, global fast-food chains to small stalls along the streets and everything in between, the Thais are spoiled for choice. In addition, as the world becomes globalized, consumers are familiar with international dishes and would not hesitate to try new offerings from the other side of the globe. As a...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
Asia’s e-commerce landscape has been booming in recent years. The swift adoption of smartphones and greater...
Asia’s e-commerce landscape has been booming in recent years. The swift adoption of smartphones and greater access to the internet has allowed consumers in the region to be a major force in the global digital economy. The expansion looks set to continue at a rapid pace. According to a November 2018 report by Fitch Solutions, e-commerce sales in the region are forecast to increase by 14.2% this year, with an estimated average annual increase of 14% over the medium term...
Q1. Use Union statements to show the following: list the number of artists that have a...
Q1. Use Union statements to show the following: list the number of artists that have a webaddress, the number of artists that do not have a webaddress, and the total number of artists. The output should look like: +--------------------------+----------+ | Has webaddress | count(*) | +--------------------------+----------+ | Has webaddress | 5 | | Does not have webaddress | 6 | | Total | 11 | +--------------------------+----------+ Q2. A new salesperson has been hired. Their SalesID is 5, full name is...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT