Question

In: Computer Science

We continue from the two tables in lab 3 part 2, and practice with functions and...

We continue from the two tables in lab 3 part 2, and practice with functions and the GROUP BY statement. The data in each table should be as below

Table Product:

PROD_ID

PROD_NAME

PROD_PRICE

PROD_VENDOR

1101

Table

100

2

1102

Chair

80

3

1103

Armchair

90

2

1104

Nightstand

110

1

1105

Bed

200

3

1106

Dresser

150

3

1107

Daybed

190

2

1108

Ash Table

120

2

1109

Cherry Table

130

2

1110

Table - High

100

2

1111

Office Chair

110

3

Table Vendor:

VEND_ID

VEND_NAME

VEND_ST

1

Green Way Inc

GA

2

Forrest LLC

NC

3

AmeriMart

NC

Please write the SQL script and provide screenshots of results for these below queries. Please include the SQL in text format, and all screenshots in one single document.

  1. Find the total number of table products
  2. Find the average price of all tables
  3. Find the total number of products from each vendor
  4. Find the average prices by vendors (please include vendor names in the query result)
  5. Find the average prices by states

Solutions

Expert Solution

SQL Query 1:

select count(Prod_name) as 'number of table product' from product
where Prod_name like '%Table%';

query result :

*************************

SQL Query 2:

select avg(prod_price) from product
where Prod_name like '%Table%';

query result :

*************************

SQL Query 3:

select vend_name , count(prod_id) as 'Number of products'
from vendor,product
where
vendor.vend_id=product.PROD_VENDOR
group by vend_name;

query result :

*************************

SQL Query 4:

select vend_name , avg(prod_price) as 'Average price by vendor'
from vendor,product
where
vendor.vend_id=product.PROD_VENDOR
group by vend_name;

query result :

*************************

SQL query 5:

select VEND_ST , avg(prod_price) as 'Average price by state'
from vendor,product
where
vendor.vend_id=product.PROD_VENDOR
group by VEND_ST;

Query result :

****************************


Related Solutions

We continue from the two tables in lab 3 part 2, and practice with functions and...
We continue from the two tables in lab 3 part 2, and practice with functions and the GROUP BY statement. The data in each table should be as below Table Product: PROD_ID PROD_NAME PROD_PRICE PROD_VENDOR 1101 Table 100 2 1102 Chair 80 3 1103 Armchair 90 2 1104 Nightstand 110 1 1105 Bed 200 3 1106 Dresser 150 3 1107 Daybed 190 2 1108 Ash Table 120 2 1109 Cherry Table 130 2 1110 Table - High 100 2 1111...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and use a function named highest() that takes three inputs and returns the highest number. After you have got it working, try calling the function with inputs ‘hat’, ‘cat’, ‘rat’.
Lab 1 – Databases, Schemas, and Basic Tables For this lab we will be creating a...
Lab 1 – Databases, Schemas, and Basic Tables For this lab we will be creating a small Student Loan Database. Make sure to open your screenshot word document. Include the required screenshots of your code in the document. Database: Create a new database: StudentLoan_LastName. Schemas: Create the following schemas. Make sure to screenshot and run your code: 1. Student 2. Guarantor 3. Institution 4. Activity 5. Loan 6. Lender Tables: First complete the word document for designing the tables like...
17.1 Lab Lesson 10 (Part 1 of 2) Part of lab lesson 10 There are two...
17.1 Lab Lesson 10 (Part 1 of 2) Part of lab lesson 10 There are two parts to lab lesson 10. The entire lab will be worth 100 points. Bonus points for lab lesson 10 There are also 10 bonus points. To earn the bonus points you have to complete the Participation Activities and Challenge Activities for zyBooks/zyLabs unit 16 (Gaddis Chapter 7). These have to be completed by the due date for lab lesson 10. For example, if you...
In this lab we will write 3 functions: GenData: This function will take an integer parameter...
In this lab we will write 3 functions: GenData: This function will take an integer parameter and return a vector with that many random integers generated in the range of 0 and 100 (rand()%101). Seed the random number generator with 22. Mean(): This function will take a vector and return the mean. Variance(): This function will take a vector and return the population variance, as: [Sum for values[( x_i - Mean )^2]] / (number of items) In Main: Use GenData...
Language: C++ 3 Campus Travel Game This lab will practice using loops. We will construct a...
Language: C++ 3 Campus Travel Game This lab will practice using loops. We will construct a short computer game. Please look at the Test Cases for exact wording. For your game, the player’s goal is to reach campus exactly. The player starts 14 miles away and has up to 4 turns to reach campus. At each turn the play can ride either use a Bus, a Subway, or a Jetpack: Riding a Bus moves the player forward 2 miles each...
2.       The next two tables are summaries from a neighborhood survey. Use the information in the tables...
2.       The next two tables are summaries from a neighborhood survey. Use the information in the tables to summarize the results of the survey. Which of the neighborhoods would you consider the lowest income neighborhood? Explain your answer? TABLE 2 CROWN HEIGHTS,   EAST NEW YORK PROSPECT HEIGHTS / FLATBUSH BED-STUY / BUSHWICK INCOME Count % Count % Count % LESS THAN $15,000 45 19.7% 5 7.8% 11 8.3% $15,000 - $24,999 69 30.1% 25 39.1% 38 28.6% $25,000 - $34,999 64...
Construct a graph from Tables 2 and 3 on a computer program such as Microsoft Excel®. Send your graph with your Post-Lab Questions to your lab instructor.
  Table 1: Hot Sauce Titration mass of hotsauce (g) 0.8 Concentration of NaOH solution used 0.1M Volume needed of NaOH to neutralize the sauce_______? pH of NaOH 12.5 Table 2: Hot Sauce pH Titration Data Trial 1 Increments of NaOH Added (mL) Total NaOH Added (mL) Hot Sauce pH 0 0 3.7 1.0 1.0 4.1 1.0 2.0 4.4 1.0 3.0 4.8 1.0 4.0 5.6 1.0 5.0 9.7 1.0 6.0 11.2 1.0 7.0 11.5 1.0 8.0 11.7 1.0 9.0 11.9...
1. A product of two functions (exponential) 2. A quotient of two functions (logarithmic) 3. example...
1. A product of two functions (exponential) 2. A quotient of two functions (logarithmic) 3. example of a composite function 4. A sum of two functions (rational) 5. A difference of two function (rational or either trigonometric) for all the functuons you come up w please give the domin range x and y int ans local max and min.
1. Will we continue to see the turnover rates continue in the Allied health professions? 2....
1. Will we continue to see the turnover rates continue in the Allied health professions? 2. Why are the Allied Health Professions also seeing shortages throughout the country and beyond? 3. Does this differ from countries outside the US? 4. Why does the turnover in the Allied Health professions seem particularly high? 5. What are your recommendations to your healthcare organization to continue to experience these shortages? https://maryville.instructure.com/courses/45129/files/7709449/download?wrap=1 https://www.nsinursingsolutions.com/Documents/Library/NSI_National_Health_Care_Retention_Report.pdf
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT