It's UWAweek 47

help1402

This forum is provided to promote discussion amongst students enrolled in CITS1402 Relational Database Management Systems.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 684 articles.
Currently 143 other people reading this forum.


 UWA week 41 (2nd semester, week 11) ↓
SVG not supported

Login to reply

👍x1
helpful
12:07pm Wed 9th Oct, John K.

I've been working on lab 5 Q7:

Find the po_ids that have ordered items costing more than the average price of all items, along with the total cost of those items.

Hint use a subquery to calculate the average price of items.

However the answer the checker expects doesn't seem to filter by average price or use subqueries at all. It just lists the grouped total_price for each po_id. In fact I only managed to solve this question by writing a query that did this without filtering by average price, or using a subquery at all. Literally just SELECT, SUM, FROM, JOIN and GROUP BY.

Checker Expected result:

|po_id | total_cost| |---------- | ----------| |AAA | 2217.5| |BBB | 255| |CCC | 5787.5| |DDD | 10000| |GGG | 1000| |HHH | 3030.0| |III | 2499.5 |

However because of the wording of the question and the mention of averages I think this may be incorrect and that the correct answer should be more filtered rather than just including the total grouped cost for every po_id. I think it should probably look more like this:

What I think the result should be

|po_id | total_cost| |----------| ----------| |AAA | 2217.5| |CCC | 5787.5| |GGG | 1000|

I think this is more likely the correct result because if you add up the prices for all the items then divide by how many types of items there are only AAA, CCC and GGG have ordered any items higher than the average price calculated in this way.

I'll probably still submit the checker correct answer anyway to get full marks through the automated marking system but I'm posting here just in case it's an unintentional error in the question that might need to be fixed or clarified for other students.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy