This is the only problem I'm having issues with. Display the id, the description, and the total
Question:
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 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)
Intermediate Accounting
ISBN: 978-0324300987
10th Edition
Authors: Loren A Nikolai, D. Bazley and Jefferson P. Jones