Question

This code must be in SQL - Run the script provided with the assignment. This will...

This code must be in SQL -

Run the script provided with the assignment. This will create the tables used for this assignment. Write the necessary SQL commands to perform the required actions. Run the queries to obtain results from the database. (Make sure all columns returned have proper headings.)

3

  1. 2

    In a single row show the following values: how many unique manufacturers are in the products table. What is the most expensive price per unit in the products tables and the least expensive product in the products table.
  2. What is the average sales from sales reps who work from home?
  3. 2

    Show each Customer number and the total amount spent on Orders to date.

3

  1. Display each Sales Rep's Name followed by a count of how many customers they have.

3

  1. Show us the total amount of sales to date for each Product. Note that a Product is a combination of Manufacturer and Product. Please order your results by the largest total sales first.

4

  1. A Manufacturer has many products. (Example: ACI has around 7 different Products) Show us a listing of all the Manufacturers and a count of their products. NOTE: we do not care about products worth less than $0.50, remove those products from your counts. Additionally, we only want to see manufacturers if they have at least 4 different products.

4

  1. Using a non-correlated SUBQUERY, Show us the value of the highest credit limit between all customers of Sue Smith and Paul Cruz.

4

  1. Use a correlated SUBQUERY to solve this question. We want to see products that are selling well. Show us all of products (Mfr/Product) and their description. But only show us products where the total amount sold to date is more than 20 times the current price of a single product.

Example:
ACI 41002 is one of the products you should display because…
Price per unit is $0.76, 20 times that value is $15.20
The sum of all orders containing ACI 41002 is $48.64, which is larger than $15.20!

5

  1. Use a SUBQUERY and the key word EXISTS. Show all the Companies who have placed an order between January 1st, 2000 and January 1st, 2001
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Since you have not provided the table schema and column names, it is impossible for me to provide you correct working SQL Queries.

For time being, I am guessing the table and column names and providing you the queries. Hence, you might need to change the names accordingly in order to make them wrong. In case you need any help, reach out to me via comments section.

1. SELECT count(DISTINCT manufacturer), max(unitPrice), min(unitPrice) FROM Products;

2. SELECT avg(sales) FROM SalesRep WHERE work_location = 'Home';

3. SELECT CustNum, sum (amount) FROM Customer c JOIN Orders o ON c.CustNum = o.CustNum GROUP BY o.CustNum;

NOTE: As per Chegg policy, I am allowed to answer only 3 questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.

Add a comment
Know the answer?
Add Answer to:
This code must be in SQL - Run the script provided with the assignment. This will...
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...

  • Questions in this part ask you to write SQL queriesthat would retrieve certain information from the...

    Questions in this part ask you to write SQL queriesthat would retrieve certain information from the tables. For each question, write the SQL query that would display the information asked by the question. Display information about parts that have their weights greater than the average weight of all parts.   PNO PNAME P2 BOLT P3 SCREW Find supplier numbers who supply any screws (i.e., such that the part name is ‘screw’).  The constraint is that you may not use any join or...

  • CIS336: Lab 6: Group Functions and Subqueries I desperatly need help with this MYSQL lab. Any...

    CIS336: Lab 6: Group Functions and Subqueries I desperatly need help with this MYSQL lab. Any help is appreciated. I don't need the outputs, I just need working codes. 1.Write a query to display the description of a product and the number of orders for that product. Sort the display by the description. 2.Redo the previous problem but this time just display those product names and the number of sales that have more than 3 sales. 3. Use a SubQuery...

  • 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...

  • This assignment consists of a series of SQL questions. For each question, you will need to...

    This assignment consists of a series of SQL questions. For each question, you will need to include: • SQL query. • An explanation of the query. Please include explanations as a comment AFTER your query, e.g., enclosed within a /* comments block */ ). See the first example in the SQL tutorial for a comment. You don’t need to explain straightforward code in comments. Only the parts that are interesting or different, so that we understand what you did. Question-1...

  • Given the following relational schema, write queries in SQL to answer the English questions. The Access...

    Given the following relational schema, write queries in SQL to answer the English questions. The Access Database for the schema is available, as is a DDL file. It is also available on the MySQL server. You must only submit the SQL for your answers. You can get your answers without using a DBMS or by using Access or MySQL. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid:...

  • Using MYSQL please help (#7){Screen shot} Write a script that removes the view, the two tables, and the database, with one click of the execute button. In the screen shot, display all the SQL code, an...

    Using MYSQL please help (#7){Screen shot} Write a script that removes the view, the two tables, and the database, with one click of the execute button. In the screen shot, display all the SQL code, and show the Object Explorer after the script executes. Add records to the Category table and the Products table. One screenshot should show the SQL code and the output of a SELECT statement showing the records in the table (two screenshots, one for each table)...

  • Use the give table below to answer the following questions. sName Smith sCity SI S2 PI...

    Use the give table below to answer the following questions. sName Smith sCity SI S2 PI P2 P3 P4 PS Nut Bolt Red Blue 12 17 17 10 Blake Paris Screw Red S4. S5 30 Athens Blue 12 SP SNo (PK) (FK S1 S1 S1 S1 S1 S2 S2 S3 S3 S3 S4 P1 P2 P3 P4 PS PI P2 Pl P2 P3 P2 P3 P4 200 100 100 200 200 200 S5 Table: Content of the Supplier-Parts DB Tables...

  • 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...

  • Summarize these pages in your own style and you have to include in your report some...

    Summarize these pages in your own style and you have to include in your report some figures highlighting the relation between these operations. Basic AGGREGATE functions (Revision) COUNT: returns the number of tuples, which meet the specified condition: SELECT COUNT(DISTINCT Dept) AS Num_Depts FROM subject: SUM: returns the sum of the values in a specified column (i.e. numeric column) SELECT COUNT(*) AS hi_sal, SUM(salary) FROM Lecturer WHERE Salary > 4500 MIN: returns the minimum value in a specified column (numeri...

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