select : 데이터 가져오기
from : 어느 테이블에서 가져올지
ex)
select *
from food_orders
:food_orders 테이블의 모든 컬럼을 가져오다
select price
from food_orders
:food_orders 테이블의 price 컬럼(가격정보)을 가져오다
컬럼 이름 변경
컬럼 as 별명 또는 컬럼 별명
별명이 특수문자나 한글일 때는 큰따옴표 사용
select price as p
from food_orders
select price p
from food_orders
:food_orders 테이블의 price 컬럼의 이름을 p로 바꾼다
select price as "가격"
from food_orders
select price "가격"
from food_orders
:food_orders 테이블의 price 컬럼의 이름을 가격으로 바꾼다
'SQL' 카테고리의 다른 글
if, case (0) | 2024.08.29 |
---|---|
replace, substring, concat (1) | 2024.08.28 |
group by, order by (1) | 2024.08.28 |
기본 연산, 최대/최소, 개수 구하기 (0) | 2024.08.27 |
where 절의 비교연산, between, in, like, 논리연산 (0) | 2024.08.27 |