Question

In: Computer Science

Table Product: PROD_ID PROD_NAME PROD_PRICE PROD_VENDOR 1101 Table 100 2 1102 Chair 80 3 1103 Armchair...

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

Answer:

   /*find total nnumber of table products*/

   Select count(*) as TOTAL_TABLE_PROD from PRODUCT where PROD_NAME like '%table%';

   /*Find the average price of all tables */

   select avg(PROD_PRICE) as TABLE_AVG_PRICE from PRODUCT where PROD_NAME like '%table%' ;

   /*Find the total number of products from each vendor */

   select PROD_VENDOR, count(*) as TOTAL_PRODUCT from PRODUCT group by PROD_VENDOR;

   /*Find the average prices by vendors */

   select P.PROD_VENDOR, V.VEND_NAME, avg(P.PROD_PRICE) as AVG_PRICE from
       PRODUCT P join Vendor V on P.PROD_VENDOR = V.VEND_ID group by P.PROD_VENDOR;

   /*Find the average prices by states*/

   select V.VEND_ST, P.PROD_VENDOR , avg(P.PROD_PRICE) as AVG_PRICE from
       PRODUCT P join Vendor V on P.PROD_VENDOR = V.VEND_ID group by V.VEND_ST;

Complete SQL QUERIES Screenshot:


Related Solutions

Year   Project A   Project B 0 –$200   –$200    1 80   100    2 80 100...
Year   Project A   Project B 0 –$200   –$200    1 80   100    2 80 100    3 80 100    4 80       a)   If the opportunity cost of capital is 10%, which of these projects is worth pursuing? Explain. b)   Suppose that you can choose only one of these projects. Which would you choose? The discount rate is still 10%. Justify your reasoning. c)   Which project would you choose if the opportunity cost of capital were 16%?...
Multiply two binary numbers1101 and 1101 using a serial multiplier. Show all steps in a table.
Multiply two binary numbers1101 and 1101 using a serial multiplier. Show all steps in a table.
Time 0 1 2 3 4 5 Cash flows -800 80 100 300 500 500 Financing...
Time 0 1 2 3 4 5 Cash flows -800 80 100 300 500 500 Financing rate=15% Reinvestment rate=20% a) Write the excel command to calculate the NPV: b) Write the NPV numerical value: c) Write the excel command to calculate the IRR: d) Write the IRR numerical value: e) Write the excel command to calculate the MIRR: f) Write the MIRR numerical value: h) Write the excel command to calculate the PI: i) Write the PI numerical value:
PRODUCT 1 PRODUCT 2 Demand 80 80 Time/Unit 30 20 Sale Price 50 30 Variable Cost/Unit...
PRODUCT 1 PRODUCT 2 Demand 80 80 Time/Unit 30 20 Sale Price 50 30 Variable Cost/Unit 10 5 Contribution Margin/Unit 40 25 Contribution Margin Ratio 60% 40% Contribution Margin/Unit of Time 0.33 0.50 Assume the maximum time allowed is only 3,900 per day. Calculate and compare the profitability of the following scenarios: I. The product with the highest contribution margin prioritized. II. The product with the highest contribution margin per unit of constrained resource is prioritized. B How do managers...
Sample Size No. Defective 1 80 4 2 72 2 3 68 3 4 81 3...
Sample Size No. Defective 1 80 4 2 72 2 3 68 3 4 81 3 5 75 4 6 70 4 7 82 5 8 64 1 9 73 1 10 78 5 11 70 3 12 74 4 13 83 1 14 76 12 15 66 4 16 70 7 17 71 4 18 82 7 19 73 4 20 67 6 21 80 2 22 79 7 23 81 2 24 81 4 25 78 4 26...
Matt is sitting in a chair at a table anxiously waiting for his Chinese takeout to...
Matt is sitting in a chair at a table anxiously waiting for his Chinese takeout to arrive. The doorbell rings and Matt moves from his chair to go to the door to meet the delivery person. In the process of moving from his chair to ultimately sitting back in his chair and eating his sweet and sour chicken with rice, he has to progress through a series of motions. First he must stand upright from his sitting position in the...
Data Table 3: 80-L Driver-Side Air Bag Activity Calculations Moles of CO2 required to inflate 80-L...
Data Table 3: 80-L Driver-Side Air Bag Activity Calculations Moles of CO2 required to inflate 80-L driver-side air bag at room temperature and pressure 3.25moles Balanced equation for the reaction of NaHCO3 and CH3COOH NaHCO3+CHCOOH=CH3COONa+H2O+CO2 Grams of NaHCO3 needed for the reaction 273 g mL of CH3COOH (0.833 M) needed for the reaction 3.9 L, 3900mL Data Table 4: 160-L Front Passenger-Side Air Bag Activity Calculations Moles of CO2 required to inflate 160-L front passenger-side air bag at room temperature...
ACTIVITY 3 Fill in the table below. Capital Total Product Marginal Product Average Product 0 0...
ACTIVITY 3 Fill in the table below. Capital Total Product Marginal Product Average Product 0 0 ------------------ ----------------- 1 20 2 50 3 90 4 136 5 170 6 198 At what amount of capital do we see diminishing marginal returns? Fill in the table below. Capital Total Product Marginal Product Average Product 0 0 -------------------- ------------------ 1 45 2 65 3 58 4 224 5 36 6 48 At what amount of capital do we see diminishing marginal returns?...
Question 2 Consider the demand schedule for the product produced by a monopolist in Table 2....
Question 2 Consider the demand schedule for the product produced by a monopolist in Table 2. Table 2: Quantity Demanded Price (RM) Total Revenue Marginal Revenue 1 325 2 300 3 275 4 250 5 225 6 200 7 175 8 150 9 125 10 100 11 75 12 50 13 25 14 0 a) Complete the table.                                                                                                                               [14 marks] b) What do the data in the table indicate about the relationship between total revenue and     marginal...
Below is a table showing the production numbers for a chair factory (where the production numbers...
Below is a table showing the production numbers for a chair factory (where the production numbers are based on chairs being produced per day). Workers Total Product (TP) Average Product (AP) Marginal Product (MP) Value of the Marginal Product (VMP) 0 0 - - - 1 20 2 60 3 40 4 180 5 46 6 270 7 300 8 40 9 10 10 5 a) Fill in the missing numbers for the TP, AP and MP columns (round to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT