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 132 other people reading this forum.


 UWA week 35 (2nd semester, week 6) ↓
SVG not supported

Login to reply

👍?
helpful
5:10pm Thu 29th Aug, Chien-An T.

Given the statement "Then group according to the creditcode for all the cases where 'EITHER' the count is greater than 2 or the city or phone is not empty." in the Question, we know that EACH of the following fulfilled SHOULD be listed: 1. count(cust_id) is greater than 2 2. the city or phone is not empty So these are the "OR" relationship, for instance, the following extreme condition should be listed: a. count(cust_id) <= 2 but the city or phone is not empty b. count(cust_id) > 2 but the city and phone are both empty And since the WHERE query will process before aggregator and grouping/having queries, we cannot use WHERE query for this 'OR' relationship otherwise it will become an 'AND' relationship Hence the query should be: SELECT creditcode, count(cust_id) AS 'Number of Publishers' FROM publishers GROUP BY creditcode HAVING COUNT(cust_id) > 2 OR city IS NOT NULL OR phone IS NOT NULL ORDER BY creditcode;

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