"20201029"의 두 판 사이의 차이

phj
이동: 둘러보기, 검색
(새 문서: ==확장된 join~=== --2b. 일본 또는 중국의 한국학 연구자 중 -- 강사, 전임강사, 조교수, 부교수, 초빙교수, 교수 신분의 사람이 참여하는 -...)
 
 
(같은 사용자의 중간 판 2개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==확장된 join~===
+
==확장된 join~==
  
--2b. 일본 또는 중국의 한국학 연구자 중  
+
--2b. 일본 또는 중국의 한국학 연구자 중  
--   강사, 전임강사,  조교수, 부교수, 초빙교수, 교수 신분의 사람이 참여하는  
+
-- 강사, 전임강사,  조교수, 부교수, 초빙교수, 교수 신분의 사람이 참여하는  
--   프로그램과  대학
+
-- 프로그램과  대학
--   그리고, 그 사람의 전화번화와
+
-- 그리고, 그 사람의 전화번화와
  
*테이블의 혼돈이 있을 경우 institute.institute_id 등의 '''테이블의 이름'''을 밝혀줘야함.  
+
*테이블의 혼돈이 있을 경우 institute.institute_id 등의 '''테이블의 이름'''을 밝혀줘야함.  
select institute_name, program_name, title, affiliation.person_name, person.phone, person.email from affiliation
+
select institute_name, program_name, title, affiliation.person_name, person.phone, person.email from affiliation
join program on affiliation.program_id=program.program_id
+
join program on affiliation.program_id=program.program_id
join institute on program.institute_id=institute.institute_id
+
join institute on program.institute_id=institute.institute_id
join person on affiliation.person_name=person.person_name  
+
join person on affiliation.person_name=person.person_name  
where title in ('강사', '전임강사',  '조교수', '부교수', '초빙교수', '교수')
+
where title in ('강사', '전임강사',  '조교수', '부교수', '초빙교수', '교수')
and state_name in ('일본', '중국')
+
and state_name in ('일본', '중국')
 +
 
 +
/*8.독일에서 한국학 프로그램이 개설된 대학을 프로그램 개설 연도 순으로 나열*/
 +
 
 +
select establishment, institute_name, state_name,program_name from institute
 +
join program on institute.institute_id=program.institute_id where state_name='독일'
 +
order by establishment desc  '''/*asc 오래된순서로, desc 최신순서로 */'''
 +
 
 +
  /*미국에서 한국학 저널을 발행하지 않는 대학 */
 +
select state_name, institute_name, journal_name from journal
 +
right join institute on journal.institute_id=institute.institute_id
 +
where journal_id is NULL
 +
 
 +
/*affiliation 과 person 확인(affiliation이 없는 person을 찾아보기) */
 +
 
 +
select * from person
 +
left join affiliation on person.person_name=affiliation.person_name
 +
where affiliation_id is NULL

2020년 10월 29일 (목) 10:51 기준 최신판

확장된 join~

--2b. 일본 또는 중국의 한국학 연구자 중 
-- 강사, 전임강사,  조교수, 부교수, 초빙교수, 교수 신분의 사람이 참여하는 
-- 프로그램과  대학
-- 그리고, 그 사람의 전화번화와
*테이블의 혼돈이 있을 경우 institute.institute_id 등의 테이블의 이름을 밝혀줘야함. 
select institute_name, program_name, title, affiliation.person_name, person.phone, person.email from affiliation
join program on affiliation.program_id=program.program_id
join institute on program.institute_id=institute.institute_id
join person on affiliation.person_name=person.person_name 
where title in ('강사', '전임강사',  '조교수', '부교수', '초빙교수', '교수')
and state_name in ('일본', '중국')
/*8.독일에서 한국학 프로그램이 개설된 대학을 프로그램 개설 연도 순으로 나열*/
select establishment, institute_name, state_name,program_name from institute
join program on institute.institute_id=program.institute_id where state_name='독일'
order by establishment desc  /*asc 오래된순서로, desc 최신순서로 */
 /*미국에서 한국학 저널을 발행하지 않는 대학 */
select state_name, institute_name, journal_name from journal
right join institute on journal.institute_id=institute.institute_id
where journal_id is NULL
/*affiliation 과 person 확인(affiliation이 없는 person을 찾아보기) */
select * from person
left join affiliation on person.person_name=affiliation.person_name
where affiliation_id is NULL