huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793255964
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -309,6 +393,116 @@ DESC StudentInfo;
| age| int| NULL|
+-----------------------+---------+-------+
+-- Drop columns of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| LastName| string| NULL|
+| DOB|timestamp| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo DROP columns (LastName, DOB);
+
+-- After dropping columns of the table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+-- Rename a column of a table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| name| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo RENAME COLUMN name TO FirstName;
+
+-- After renaming a column of the table
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| FirstName| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+-- ALTER OR CHANGE COLUMNS
+DESC StudentInfo;
++-----------------------+---------+-------+
+| col_name|data_type|comment|
++-----------------------+---------+-------+
+| FirstName| string| NULL|
+| rollno| int| NULL|
+| age| int| NULL|
+|# Partition Information| | |
+| # col_name|data_type|comment|
+| age| int| NULL|
++-----------------------+---------+-------+
+
+ALTER TABLE StudentInfo ALTER COLUMN FirstName COMMENT "new comment";
+
+--After ALTER or CHANGE COLUMNS
Review comment:
nit: space after `-`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]