본문 바로가기
2022/DB 데이터베이스

[DB]실습3

by Or0i쿠 2022. 10. 6.

 

20221006​
select * from 학생;
select * from 학생 where 주소 like binary '%과천';
-- 소속학과 컴퓨터 , 주소는 분당인 사사람의 이름 출력
select 이름 from 학생 where 소속학과='컴퓨터' and 주소 like '%분당'; ​


select 학번 from 학생 where 성별 = '여'
union
select 학번 from 수강 where 평가학점 ='A';
 


-- 남학생이거나 과목번호가 c00 인사람이 학번
select 학번 from 학생 where 성별 = '남'
union
select 학번 from 수강 where 과목번호 = 'c003'
​
​
select*from 학생 where 소속학과 in('통계','정보통신');​


-- 수강테이블 에서 A와B 학점의 학번 출력
select 학번 from 수강 where 평가학점 in ('A');
-- 수강에서 에이와비 학점 A/B 학점 학생수
select count(*) as 'A/B 학점 학생수' from 수강  where 평가학점 in ('A','B');​
 
 

select 과목번호 from 과목 Where 이름 = '과목번호';

select 학번 from 수강 where 과목번호 =( select 과목번호 from 과목 where 이름 ='정보보호');

select 학번 ,이름 from 학생 where 학번 in (select 학번 from 수강 where 과목번호 =( select 과목번호 from 과목 where 이름 ='정보보호'));​
 

 

 
 

'2022 > DB 데이터베이스' 카테고리의 다른 글

SQL 7W  (0) 2022.11.03
[DB] 데이터베이스 개념  (0) 2022.10.07
[DB]실습 2  (0) 2022.10.06
[DB] my sql 실습  (1) 2022.10.06
[DB]데이터베이스 데이터 모델  (0) 2022.10.06