sql - select department name query pre-requiste -
i have 3 tables shown below :
courses( number: integer, deptname: string, coursename: string, classroom: string, enrollment: integer) departments( name: string, chairmanpid: string) prereq( number: integer, deptname: string, prereqnumber: integer, prereqdeptname: string)
and have find which departments have courses have pre-requisites in other departments?
try this
select d.name,c.coursename, p.deptname department d inner join courses c on c.deptname=d.deptname inner join prereq p on p.prereqdeptname=d.deptname , p.deptname <> d.deptname
Comments
Post a Comment