Updated on 2026-11-06 GMT+08:00
Create View
Function
Create a view.
Syntax
CREATE [OR REPLACE] VIEW view_name
[WITH SCHEMA { BINDING | COMPENSATION | EVOLUTION | TYPE EVOLUTION }]
AS select_statement; Keywords
- CREATE VIEW: Create a view based on the given SELECT statement. The results of the SELECT statement are not written to disk.
- OR REPLACE: When this keyword is specified, no error is raised if the view already exists, and the view definition is updated according to the SELECT statement.
- WITH SCHEMA: Specifies the schema management strategy for the view.
- BINDING: Strict binding. The view becomes invalid when the underlying table structure changes.
- COMPENSATION: Compensation mode (default). Tolerates column type changes.
- EVOLUTION: Evolution mode. Automatically follows changes in the underlying table schema.
- TYPE EVOLUTION: Type evolution. Only allows column type evolution.
Precautions
- The view to be created must not already exist in the current database. Otherwise, an error will occur. When the view exists, the error can be avoided by adding the OR REPLACE keyword.
- The information of tables or views included in the view cannot be changed. Any changes may cause query failures.
- If the compute engines used for creating the table and the view are inconsistent, view queries may fail due to incompatible varchar types.
Examples
Query the id and name data from the student table, and create the view student_view based on the query results.
CREATE VIEW student_view AS SELECT id, name FROM student;
Create a view with a schema evolution strategy:
CREATE VIEW student_view WITH SCHEMA EVOLUTION AS SELECT id, name FROM student;
Parent topic: View Syntax
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot