Thursday, 15 August 2013

sql - Confused about joins -



sql - Confused about joins -

i have next sql structure

department: id, name students: id,name department_students: student_id, department_id

find departments more 10 students

find students not in tech department

how utilize bring together this?

sorry terrible indentation

select * pupil s not exists ( select 1 student_department sd bring together section d on sd.student_id = s.id , sd.department_id = d.id , d.name = 'tech' ) select d.name section d bring together student_department sd on d.id = sd.department_id grouping sd.department_id having count(*)>10

sql join

No comments:

Post a Comment