[Database class] improved teacher-course query
Paul S. Wang
pwang at cs.kent.edu
Thu Feb 24 11:30:02 EST 2011
Dear database class,
Here is one way of achieving what we wanted in class: displaying
teacher-course name info without duplicating course names.
SELECT name, GROUP_CONCAT( title )
FROM
(SELECT name, title
FROM (instructor NATURAL JOIN teaches) NATURAL JOIN course
GROUP BY name, title) AS temp
GROUP BY name
ORDER BY name
Try it yourself.
Paul
--
==============================================================================
Paul S. Wang Email: pwang at cs.kent.edu
Director of Research, ICM/Kent Tel: (330) 672-9051
Dept. of Computer Science, Kent State U. FAX: (330) 672-2725
Kent, Ohio, USA 44242-0001 http://www.cs.kent.edu/~pwang/
Institute for Computational Email: icm at mcs.kent.edu
Mathematics (ICM) http://icm.mcs.kent.edu/
==============================================================================
More information about the Dbclass
mailing list