본문 바로가기
SK 행복성장캠퍼스/SQL

2020-09-08, SQL_1일차_연습문제

by NickNuma 2020. 9. 9.

일단 연습문제에 사용할 데이터 테이블은 이렇다.


 


더보기
SELECT department_name as "학과 명", category "계열"
FROM TB_department;

 


더보기
SELECT department_name || '의 정원은 ' || capacity || '명 입니다' as "학과별 정원"
FROM TB_department;

 


더보기
SELECT student_name
FROM TB_STUDENT
where department_no = 001 and absence_yn = 'Y' and student_ssn LIKE '_______2%';

 


더보기
SELECT student_name
FROM TB_STUDENT
where student_no in ('A513079', 'A513090', 'A513091', 'A513110', 'A513119');

 


더보기

Between A and B 사용

select department_name, category
from TB_department
where capacity between 20 and 30;

비교 연산자와 논리 연산자 사용

select department_name, category
from TB_department
where 20 <= capacity and capacity <= 30;

 


더보기
select professor_name
from TB_professor
where department_no is Null;

 


더보기
select student_name
from TB_student
where department_no is null;

 


더보기
select class_no, class_name
from TB_class
where preattending_class_no is not null;

 


더보기
select distinct category
from TB_department;

 


더보기
select student_no, student_name, student_ssn
from TB_student
where Entrance_date like '02%' and absence_yn = 'N' and student_address like '전주%';

 

 

 

반응형

댓글