I have several tables:
lecturer(id,name,email)
- 1,john,john@abc.com
- 2,andy,andy@abc.com
- 3,kyle,kyle@abc.com
- 4,allen,allen@abc.com
sig(id,name)
- s1, Multimedia
- s2, Business IT
expertise(id, description);
- e1, Gaming
- e2, Graphic
- e3, Multimedia System
- e4, E-Business
lecturer_has_expertise(lecturer.id,expertise.id)
- 1, e1
- 2, e2
- 3, e4
- 4, e1
lecturer_has_sig (lecturer.id,sig.id)
- 1, s1
- 2, s1
- 3, s2
sig_has_expertise(sig.id,expertise.id)
- s1, e1
- s1, e2
- s1, e3
- s2, e4
Here is the output I want to show:
Lecturer's Name, Email, Expertise
Basically, when a user inputs a keyword eg: Gaming into the textbox, it will show which lecturer’s expertise is gaming and since Gaming is under Multimedia,data about all lecturer in the sig of Multimedia also will be shown. For example:
Name Email Expertise
John john@abc.com Gaming
Allen allen@abc.com Gaming
Andy andy@abc.com Graphic
I manage to output only the expertise that is input by the user but not all the expertise in the same sig.
thanks in advance
So basically you want to return every teacher who either
has the specified expertise
or
belongs to a group that has the specified expertise.
This is how the above translates in SQL: