nastra commented on code in PR #9878:
URL: https://github.com/apache/iceberg/pull/9878#discussion_r1515824918


##########
docs/docs/spark-ddl.md:
##########
@@ -566,3 +566,85 @@ Tags can be removed via the `DROP TAG` sql
 ```sql
 ALTER TABLE prod.db.sample DROP TAG `historical-tag`
 ```
+
+### Iceberg Views in Spark
+
+#### Creating a View
+Creating a view in its simplest form can be done as shown below:
+```sql
+CREATE VIEW <viewName> AS SELECT * from <tableName>
+```
+
+Using `IF NOT EXISTS` prevents the SQL from failing in case the view already 
exists:
+```sql
+CREATE VIEW IF NOT EXISTS <viewName> AS SELECT * from <tableName>
+```
+
+It is also possible to use a modified schema for the view, where each column 
has an alias that is different from the source table and carries a comment.
+Additionally, the view itself can have a comment as can be seen below:
+```sql
+CREATE VIEW <viewName> (ID COMMENT 'Unique ID', ZIP COMMENT 'Zipcode')
+    COMMENT 'View Comment'

Review Comment:
   I was trying to match the example from Spark here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to