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


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

Login to reply

👍?
helpful
8:09pm Fri 30th Aug, Chien-An T.

ANONYMOUS wrote:
> In that case, shouldn't the GROUP BY clause also have phone and city in it? In one of the slides I saw that if attributes are not in an aggregate function in the HAVING clause, they must be mentioned in the GROUP BY clause.
Yes you are right The SQL standard requires that HAVING must reference only columns in the GROUP BY clause or columns used in aggregate functions. However this usage of HAVING clause is supported and workable in SQLite & MySQL (Yes we are able to derive the correct query with this syntax) If we follow the SQL standard, the following query is both syntactically & semantically correct: SELECT creditcode, COUNT(cust_id) AS 'Number of Publishers' FROM publishers WHERE city IS NOT NULL OR phone IS NOT NULL OR creditcode IN ( SELECT creditcode FROM publishers GROUP BY creditcode HAVING COUNT(cust_id) > 2 ) GROUP BY creditcode 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