🌱 오늘의 주제 : Oracle 문법 정리
🌱 Single Row Functions
- initcap : 첫 글자는 대문자로 변경
select initcap('hello my name is yuri')
from dual;
- length : 글자 수 출력
select length(ename) as length
from emp;
- substr: 글자 자르기 (첫 순서, 끝 순서)
select substr('hello', 2 ,2)
from dual;
🌱 Grouping Functions
- NO group functions in where clause (Only single row functions allowed in WHERE clause)
- 그 대신에, having을 사용! groupy by 뒤에 사용합니다.
<순서>
select column name
from tables
where conditions
group by column name
having conditions
orer by conditions
🌱 SELECT within SELECT (Subqueries)
Single-row subquery returns only one row.
🌱 Multi-Table Queries and Joins
- Inner Join
select *
from emp INNER JOIN dept
ON emp.deptno = dept.deptno
;
- RIght Join
select *
from emp RIGHT JOIN dept
ON emp.deptno = dept.deptno
;
같은 의미
select *
from emp RIGHT OUTER JOIN dept
ON emp.deptno = dept.deptno
;
- Left Join
select *
from emp LEFT JOIN dept
ON emp.deptno = dept.deptno
;
같은 의미
select *
from emp LEFT OUTER JOIN dept
ON emp.deptno = dept.deptno
;
Left Join과 Right Join 할 때, 순서 주의하자!
🌱
🌱