이러한 테이블은 다음과 같습니다MySQL의 쿼리 조인과 서브 쿼리
professor:
+-------+--------+--------+--------+------+
| empid | name | status | salary | age |
+-------+--------+--------+--------+------+
| 1 | Arun | 1 | 2000 | 23 |
| 2 | Benoy | 0 | 3000 | 25 |
| 3 | Chacko | 1 | 1000 | 36 |
| 4 | Divin | 0 | 5000 | 32 |
| 5 | Edwin | 1 | 2500 | 55 |
| 7 | George | 0 | 1500 | 46 |
+-------+--------+--------+--------+------+
works:
+----------+-------+---------+
| courseid | empid | classid |
+----------+-------+---------+
| 1 | 1 | 10 |
| 2 | 2 | 9 |
| 3 | 3 | 8 |
| 4 | 4 | 10 |
| 5 | 5 | 9 |
| 6 | 1 | 9 |
| 2 | 3 | 10 |
| 2 | 1 | 7 |
+----------+-------+---------+
course:
+----------+------------+--------+
| courseid | coursename | points |
+----------+------------+--------+
| 1 | Maths | 100 |
| 2 | Science | 80 |
| 3 | English | 85 |
| 4 | Social | 90 |
| 5 | Malayalam | 99 |
| 6 | Arts | 40 |
+----------+------------+--------+
질문은 : 물론 수학이나 과학하지만 둘
을 가르쳐 직원의반환 목록
내가 작성한 검색어는 다음과 같습니다.
select distinct professor.name from professor inner join works on professor.empid=works.empid where works.courseid in (select courseid from course where coursename ='Maths' or coursename='Science');
내가받은 출력은 다음과 같습니다
여기Arun Benoy Chacko
직원 '아룬'야해 배운 수학과 과학 모두 그가로 표시되어있다.
도와주세요!