創建視圖的語法如下:
CREATE VIEW view_name AS
SELECT column1, column2, …
FROM table_name
WHERE condition;
其中,view_name 是視圖的名稱,column1, column2, … 是視圖中包含的列,table_name 是視圖的基表,condition 是篩選條件。
以下是一個示例:
CREATE VIEW view_employee AS
SELECT emp_id, emp_name, emp_salary
FROM employee
WHERE emp_department = ‘IT’;