[Coding Test_MySQL] 2. MySQL Test 11~20

김미숙's avatar
Mar 07, 2025
[Coding Test_MySQL] 2. MySQL Test 11~20
  1. 입사일이 81/04/02보다 늦고 82/12/09보다 빠른 사원의 이름, 월급, 부서번호를 출력하라.
select ename, sal, deptno, hiredate from emp where '81/04/02' < hiredate and hiredate < '82/12/09';
notion image
 
  1. 급여가 $1,600보다 크고 $3,000보다 작은 사람의 이름, 직업, 급여를 출력하라.
select ename, job, sal from emp where sal > 1600 and sal < 3000;
notion image
 
  1. 사원번호가 7654와 7782 사이 이외의 사원의 모든 정보를 출력하라.
select * from emp where empno not between 7654 and 7782;
notion image
 
  1. 이름이 B와 J사이의 모든 사원의 정보를 출력하라.
select * from emp where ename between 'B$' and 'J$';
notion image
 
  1. 입사일이 81년 이외의 입사한 사람의 모든 정보를 출력하라.
select * from emp where substr(hiredate,1,4) != 1981;
notion image
 
  1. 직업이 MANAGER와 SALESMAN인 사람의 모든 정보를 출력하라.
select * from emp where job = 'manager' or job = 'salesman';
notion image
 
  1. 부서번호 20, 30번을 제외한 모든 사람의 이름, 사원번호, 부서번호를 출력하라.
select * from emp where deptno = 10;
notion image
 
  1. S로 시작하는 사원의 사원번호, 이름, 입사일, 부서번호를 출력하라.
select empno, ename, hiredate, deptno from emp where ename like 'S%';
notion image
 
  1. 입사일이 81년도인 사람의 모든 정보를 출력하라.
select * from emp where substr(hiredate,1,4) = 1981;
notion image
 
  1. 이름 중 S자가 들어가 있는 사람만 모든 정보를 출력하라.
select * from emp where ename like '%S%';
notion image
Share article

parangdajavous