뷰
- 가상 테이블
- 실제 데이터 저장 X
- Stored Quries
- 데이터 가상화
1
2
CREATE `OR REPLACE` VIEW `뷰명`
AS `SELECT문`;
1
2
ALTER VIEW `뷰명`
AS `SELECT문`;
예시
1
2
3
4
5
6
CREATE OR REPLACE VIEW view_students
AS
SELECT Name
, PhoneNumber
, Address
From Students;
1
2
3
4
5
6
CREATE OR REPLACE VIEW view_students(Name, PhoneNumber, Address)
AS
SELECT Name
, PhoneNumber
, Address
From Students;
1
2
3
4
5
6
7
8
CREATE OR REPLACE VIEW `view_제품별주문수량`
AS
SELECT `제품명`
,Sum(`주문수량`) AS `주문수량합`
FROM `제품`
INNER JOIN `주문세부`
ON `제품.제품번호 = 주문세부.제품번호`
GROUP BY `제품명`;