반응형
select *
from emp
where rownum<=5;
SELECT 10-3 AS "답"
FROM DUAL;
SELECT ABS(3.333)
FROM DUAL;
SELECT CEIL(4.2)
FROM DUAL;
SELECT ROUND(5.362, 1)
FROM DUAL;
SELECT SIGN(34)
FROM DUAL;
SELECT FLOOR(-13.23)
FROM DUAL;
SELECT CEIL(-13.23)
FROM DUAL;
SELECT ROUND(133.8594, 3)
FROM DUAL;
SELECT FLOOR(13/3), MOD(13,3)
FROM DUAL;
SELECT ABS(SAL-2000)
FROM EMP;
SELECT FLOOR(SAL*1.15)
FROM EMP
WHERE SAL>=1500;
SELECT ROUND(SAL*1.2)
FROM EMP
WHERE SAL<=2000;
select lower('AVBCDacc')
from dual;
select initcap('ABCDE')
from dual;
select ename, initcap(ename)
from emp;
select concat('aaa','c아아')
from dual;
select lengthb('안녕하십니까?')
from dual;
select substr('abcde',3)
from dual;
select substr('cccccaaa',1,2)
from dual;
select lpad('abcde',8, 'a')
from dual;
select rpad('abcde', 10, 'c')
from dual;
select ltrim('abcde','a')
from dual;
select rtrim('abcde','e')
from dual;
select ltrim('abcde','a')
from dual;
select sysdate
from dual;
select extract(year from sysdate)
from dual;
select hiredate, hiredate+333
from emp;
select round(3.57285, 3)
from dual;
select to_number('4443')
from dual;
select to_char('123')
from dual;
select substr(to_char('132435'), 3, 2)
from dual;
select to_char(sysdate, 'yyyy-mm-dd hh:mi am')
from dual;
select to_date('1993-04-13', 'yyyy-mm-dd')
from dual;
select ceil(to_date('2020-01-01 12:32 오후', 'yyyy-mm-dd hh:mi pm')-hiredate)
from emp;
select to_char(sysdate, 'yy-mm-dd hh:mi pm')
from dual;
select to_date('2020-02-03 12:13 오후', 'yyyy-mm-dd hh:mi pm')
from dual;
select to_char(hiredate,'yy/mm/dd')
from emp;
select sal,
case when sal<=1000 then sal*3
when sal>1000 and sal<2000 then sal*2.5
when sal>2000 then sal*3
end as "인상된 급여"
from emp;
select ename,
case when ename like 'S%' then 'S'
when ename like 'A%' then 'A'
else 'X'
end
from emp;
select ename, deptno,
decode(deptno, 10, '경영팀', 20, '인사팀', 30, '우리팀', 40,'적팀')
from emp;
select deptno,
decode(deptno,10,'true','false')
from emp;
select job, sal,
decode(job,'CLERK',sal*1.1, 'SALESMAN',SAL*1.2, 'PRESIDENT', SAL*4, 'MANAGER', SAL*1.1, 'ANALYST', SAL*1.3)
FROM EMP;
SELECT ENAME, DEPTNO, DECODE(DEPTNO,10,'TRUE')
FROM EMP;
반응형
'DB' 카테고리의 다른 글
[SQLD] 기출 필수 암기 개념 (0) | 2023.09.03 |
---|---|
[SQLD] WINDOWING 절(ROWS & RANGE) (0) | 2023.09.03 |
[SQLD] 서브 쿼리, 집합 연산자 (0) | 2023.08.30 |
[SQLD] 기출 문제 개념정리(ASC, DESC, TRIM, SUBSTAR, LPAD, RAPD, JOIN, NATURAL JOIN) (0) | 2023.08.29 |
[SQLD] 기출 개념 정리 (1) | 2023.08.28 |