Let's see a few examples of views:
CREATE VIEW [IF NOT EXISTS] [db_name.]view_name [(column_name [COMMENT column_comment], ...) ] [COMMENT view_comment] [TBLPROPERTIES (property_name = property_value, ...)] AS SELECT ...;
I will demonstrate the advantages of views using the following few examples. Let's assume we have two tables, Table_X and Table_Y, with the following schema: Table_XXCol_1 string, XCol_2 string, XCol_3 string, Table_YYCol_1 string, YCol_2 string, YCol_3 string, and YCol_4 string. To create a view exactly like the base tables, use the following code:
Create view table_x_view as select * from Table_X;
To create a view on selective columns of base tables, use the following:
Create view table_x_view as select ...