Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the only problem I'm having issues with. Display the id, the description, and the total value of eachproduct whose number of items is

This is the only problem I'm having issues with.

  1. Display the id, the description, and the total value of eachproduct whose number of items is greater than the average number ofitems for all products. You may want to use a subquery.

This is using SQL Plus.

When I input the code I receive the following error:

ORA-00934: group function is not allowed here

This is what I put but it didn't work:

SELECT prod_id, prod_desc, prod_price
FROM products
WHERE prod_quantity >
(SELECT AVG(prod_quantity)
FROM products)
ORDER BY prod_quantity DESC;

The table that's referenced is this one:

PROD_PROD_DESC PROD_QUANTITY PR P PROD_PRICE
----- -------------------- ------------- -- - ----------
BT105Blender 52 HW A 24.95
BZ117 ExerciseBicycle 47 SG C 283.95
CE163 ConvectionOven 28 AP B 186
DM182 ElectricScrewdriver 23 HW A 49.95
DS104 ElectricRange 6 AP C 395
DW111 ClothesWasher 14 AP A 399.99
FP132 PlasmaTelevision 15 HW A 999.95
KM173 ClothesDryer 16 AP B 349.95
KW114Dishwasher 7 AP C 435
KG130 Home WorkoutCenter 5 SG C 1390
RD147 HDRadio 7 HW B 280

11 rows selected.

SQL> DESCRIBE product;
Name Null? Type
----------------------------------------- ------------------------------------
PROD_ID NOT NULL CHAR(5)
PROD_DESC VARCHAR2(20)
PROD_QUANTITY NUMBER(38)
PROD_TYPE CHAR(2)
PROD_WAREHOUSE CHAR(1)
PROD_PRICE NUMBER(7,2)

Step by Step Solution

3.42 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

Step1 Create a New Database SQLite First ensure you have SQLite installed on your system You can dow... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting

Authors: Loren A Nikolai, D. Bazley and Jefferson P. Jones

10th Edition

324300980, 978-0324300987

More Books

Students also viewed these Programming questions

Question

When would you want to use a preferred supplier?

Answered: 1 week ago