Question about 'valid UNSW course id'

89 views
Skip to first unread message

Shaoyang

unread,
May 10, 2018, 1:43:16 PM5/10/18
to COMP9311 Project Q&A
Hi there,

The 'valid UNSW course id' mentioned in Q1 means as long as an id exists in 'Courses' table it is valid, is my understanding correct?

Thanks,
Shaoyang

Wei Li

unread,
May 10, 2018, 7:32:29 PM5/10/18
to COMP9311 Project Q&A
if not exists course_enrolments.course = course_id, not found

Rui Liang

unread,
May 11, 2018, 11:45:09 AM5/11/18
to COMP9311 Project Q&A
Hi Wei,

I am also confused about the invalid "course_id", according to what Kai post earlier, we should consider the function input "course_id" in the "course" table (compare with "course.id"), and if no student enrols in this course (which suggests that "course_id" will not exist in "course_enrolments" table), we should output the number of all the rooms even with room.capacity is null, but not raise an exception. If  "course_id" does not match any "course.id" in "course" table, we should raise "INVALID COURSEID".

However, according to your post, it suggests that we should consider the function input "course_id" in the "course_enrolments" table and compare with "course_enrolment.course", if the "course_id" does not match any "course_enrolment.course", we should raise an exception (which means if no student enrol in this course, then we should raise an exception). But according to Kai, we shouldn't raise an exception if "course_id" exist in "course" table event thought it does not exist in "course_enrolments" table.

So when the function input "course_id" exists in "course" table but not in "course_enrolments" table, which one should I follow?



Regards,

Rui

在 2018年5月11日星期五 UTC+10上午9:32:29,Wei Li写道:

Shaoyang

unread,
May 11, 2018, 11:02:32 PM5/11/18
to COMP9311 Project Q&A
Thank you Rui, maybe both Kai and Wei are correct however which suggestion we should follow?

在 2018年5月12日星期六 UTC+10上午1:45:09,Rui Liang写道:

Shaoyang

unread,
May 11, 2018, 11:09:21 PM5/11/18
to COMP9311 Project Q&A
Thank you Wei, you are correct since if no students enrolled in a specific course_id, it makes no sense to return all rooms. However which strategy we should follow? Thank you.


在 2018年5月11日星期五 UTC+10上午9:32:29,Wei Li写道:
if not exists course_enrolments.course = course_id, not found

Kai Wang

unread,
May 11, 2018, 11:13:26 PM5/11/18
to Shaoyang, COMP9311 Project Q&A
if not exists course_enrolments.course = course_id, raise exception.

Kai


--
You received this message because you are subscribed to the Google Groups "COMP9311 Project Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to comp9311-projec...@googlegroups.com.
Visit this group at https://groups.google.com/group/comp9311-project-qa.
To view this discussion on the web visit https://groups.google.com/d/msgid/comp9311-project-qa/b21afb6a-cc25-490c-9d5a-689b94c5328d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kai Wang

unread,
May 11, 2018, 11:41:12 PM5/11/18
to Rui Liang, COMP9311 Project Q&A
Hi Rui,

Both of these two solutions are all accepted.

Kai

--
You received this message because you are subscribed to the Google Groups "COMP9311 Project Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to comp9311-project-qa+unsub...@googlegroups.com.

Rui Liang

unread,
May 13, 2018, 10:42:59 PM5/13/18
to COMP9311 Project Q&A
Hi Kai,

Got it, thanks for your help.

Rui

在 2018年5月12日星期六 UTC+10下午1:41:12,Kai Wang写道:

Teng Long

unread,
May 22, 2018, 1:20:55 AM5/22/18
to COMP9311 Project Q&A
Hi Kai,

Just an additional guess, can we assume that every course_id from the course table will have a corresponding record from the course_enrollment table?

Regards,
Teng


在 2018年5月12日星期六 UTC+10下午1:41:12,Kai Wang写道:
Hi Rui,

Kai Wang

unread,
May 22, 2018, 1:38:48 AM5/22/18
to Teng Long, COMP9311 Project Q&A
If a course_id from the course table doesn't have a corresponding record from the course_enrollment table, you can raise an exception or treat it as a course which has no students enrolled.

We accept both of these two solutions.

Cheers,
Kai

To unsubscribe from this group and stop receiving emails from it, send an email to comp9311-project-qa+unsubscribe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "COMP9311 Project Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to comp9311-project-qa+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/comp9311-project-qa.
Reply all
Reply to author
Forward
0 new messages