Say you have a table layout like the following:
couses:
id (INT),
courseName (VARCHAR)
instructors:
id (INT),
courseId(INT),
instructor(VARCHAR)
Create a query which will print the all the courses and if one instructor is present display their name, if two instructors are present print both of their names on the row in sorted order, if more than two instructors are present instead of the instructors names display “committee“.
For instance your output would look something like this
courseId instructor1 instructor2 0 Edward Yourdon 1 Edward Dijkstra Nicholas Wirth 2 Comittee
Note: Taken from a questionnaire on TheDailyWtf. Not a homework question.