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 the 7 articles in this topic
Showing 7 of 684 articles.
Currently 135 other people reading this forum.


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

Login to reply

👍?
helpful
3:55pm Wed 28th Aug, Wujiang H.

Hi Dr Nasim, I am confused about Q10. What is the problem with the following query? SELECT job_id, po_date FROM pos WHERE po_date < '1990-01-03' GROUP BY job_id; A. The date is mentioned incorrectly B. po_date is not used in group by and is also not an aggregate function C. Order of groupby and where is wrong D. Group by always need to have a Having Statement The code provided in the question is runnable. Then, I changed it to "GROUP BY job_id, po_date" The code was also runnable and displayed the same result as without "po_date". Additionally, I changed '1990-01-01' to '1989-01-03' The code is still runnable and displays the correct result. Therefore, I am not sure why B is correct. Thank you for your assistance. Kind regards, Nate



This article has 1 attachment:

 

SVG not supported

Login to reply

👍?
helpful
4:17pm Wed 28th Aug, Yufang W.

where can I find the mock exam?


SVG not supported

Login to reply

👍?
helpful
4:20pm Wed 28th Aug, Wujiang H.

Email


SVG not supported

Login to reply

👍x2
helpful
4:53pm Wed 28th Aug, ANONYMOUS

Thanks. Question 10 is the same as worksheet2 question 2. Which has been discussed on help forum.


SVG not supported

Login to reply

👍?
helpful
5:35pm Wed 28th Aug, Wujiang H.

Cheers. Now, I am clear.


SVG not supported

Login to reply

👍?
helpful
7:35pm Wed 28th Aug, Andre H.

Actually the reason this query can run SELECT job_id, po_date FROM pos WHERE po_date < '1990-01-03' GROUP BY job_id; is Because sqlite have "bare columns" implementation in aggregation query https://www.sqlite.org/draft/lang_select.html#bare_columns_in_an_aggregate_query In short, sqlite will fill our bare column (po_date) with value from one of the rows in the group, but which row's value is used is unpredictable and can vary. Sqlite3 itself is not as strict as other popular sql languages. So I don't think you can do that "bare column" to any other sql services like PostgreSQL or MS SQL Server. At least I am sure you cannot do that in PostgreSQL, not sure about the other though. You can do your own research for it!


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
4:02pm Tue 10th Sep, James S.

I thought I would add some late mail to this. The code runs because SQL likes it!? However the rule that was introduced in the lecture states that with select a, b then a and/ or b must be either grouped or an aggregate function. B is the correct answer. Check the lecture slide/readback of the live lecture.

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