SELECT
컬럼, 계산값
FROM
테이블명
WHERE
조건식
GROUP BY
그룹화
HAVING
그릅화에서 사용되는 조건
select
집계함수
from
테이블명
COUNT()
SUN()
AVG()
집계함수 내 case when
SELECT CASE WHEN
select
case
when 조건식1 then 결과값1
when 조건식2 then 결과값2
esle 결과값3
end
from 테이블명
select
컬럼명 as 변경할 컬럼명
from
테이블명
---
select
product_name as pn
from
product_datail
---
select
product_name pn
from
product_datail
as
를 입력하지 않아도 변수명 변경 가능하다select
컬럼명
from
테이블명
where
컬럼명 in (값1, 값2)
값1 or 값2
조건을 만족하는 컬럼명 조회select
컬럼명
from
테이블명
where
컬럼명 not in (값1, 값2)
NULL : 깂이 0이 아닌
, 값 자체가 비어있는 것
select
컬렴명
from
테이블명
where
컬럼 is null
null
인 컬럼명 조회
강남
구강남
구강남