srowen commented on a change in pull request #25590: [SPARK-28791] [DOC]
Documentation for Alter table Command
URL: https://github.com/apache/spark/pull/25590#discussion_r337178659
##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -19,4 +19,239 @@ license: |
limitations under the License.
---
-**This page is under construction**
+### Description
+`ALTER TABLE` statement changes the schema or properties of a table.
+
+### RENAME
+`ALTER TABLE RENAME` statement changes the table name of an exsisting table in
the Database.
+#### Syntax
+{% highlight sql %}
+ALTER TABLE [db_name.]old_table_name RENAME TO [db_name.]new_table_name
+
+ALTER TABLE table_name PARTITION partition_spec RENAME TO PARTITION
partition_spec;
+
+{% endhighlight %}
+
+#### Parameters
+<dl>
+ <dt><code><em>old_table_name</em></code></dt>
+ <dd>Name of an existing table.</dd>
+</dl>
+<dl>
+ <dt><code><em>db_name</em></code></dt>
+ <dd>Name of the exsisting database.</dd>
+</dl>
+
+<dl>
+ <dt><code><em>new_table_name</em></code></dt>
+ <dd>New name using which the table has to be renamed.</dd>
+</dl>
+
+<dl>
+ <dt><code><em>partition_spec</em></code></dt>
+ <dd>Partition to be renamed.</dd>
+</dl>
+
+
+### ADD COLUMNS
+`ALTER TABLE ADD COLUMNS` statement adds mentioned columns to an exsisting
table.
+
+#### Syntax
+{% highlight sql %}
+ALTER TABLE table_name ADD COLUMNS (col_spec[, col_spec ...])
+{% endhighlight %}
+
+#### Parameters
+<dl>
+ <dt><code><em>table_name</em></code></dt>
+ <dd>The name of an existing table.</dd>
+</dl>
+
+
+<dl>
+ <dt><code><em>COLUMNS (col_spec)</em></code></dt>
+ <dd>Specifies the columns to be added to be renamed.</dd>
+</dl>
+
+
+### SET AND UNSET
+
+#### SET TABLE PROPERTIES
+`ALTER TABLE SET` command is used for setting the Table properties.If a
particular property was already set,
+this overrides the old value with the new one.
+
+`ALTER TABLE USET` is used to drop the table Property.
+
+##### Syntax
+{% highlight sql %}
+
+--Set Table Properties
+ALTER TABLE table_name SET TBLPROPERTIES (key1=val1, key2=val2, ...)
+
+--Unset Table Properties
+ALTER TABLE table_name UNSET TBLPROPERTIES [IF EXISTS] (key1, key2, ...)
+
+{% endhighlight %}
+
+#### SET SERDE
+`ALTER TABLE SET` command is used for setting the SERDE or SERDE Propeties in
Hive tables.If a particular property was already set,
+this overrides the old value with the new one.
+
+##### Syntax
+{% highlight sql %}
+
+--Set SERDE Propeties
+ALTER TABLE table_name [PARTITION part_spec]
+ SET SERDEPROPERTIES (key1=val1, key2=val2, ...)
+
+ALTER TABLE table_name [PARTITION part_spec] SET SERDE serde_class_name
+ [WITH SERDEPROPERTIES (key1=val1, key2=val2, ...)]
+
+{% endhighlight %}
+
+#### SET LOCATION And SET FILE FORMAT
+`ALTER TABLE SET` command can also be used for changing the file location and
file format for
+exsisting tables.
+
+##### Syntax
+{% highlight sql %}
+
+--Changing File Format
+ALTER TABLE table_name [PARTITION partition_spec] SET FILEFORMAT file_format;
+
+--Changing File Location
+ALTER TABLE table_name [PARTITION partition_spec] SET LOCATION 'new_location';
+
+{% endhighlight %}
+
+#### Parameters
+<dl>
+ <dt><code><em>table_name</em></code></dt>
+ <dd>The name of an existing table.</dd>
+</dl>
+
+<dl>
+ <dt><code><em>PARTITION (part_spec)</em></code></dt>
+ <dd>Specifies the partition on which the property has to be set.</dd>
+</dl>
+
+<dl>
+ <dt><code><em>SERDEPROPERTIES (key1=val1, key2=val2, ...)</em></code></dt>
+ <dd>Specifices the SERDE properties to be set.</dd>
+</dl>
+
+
+### Examples
+{% highlight sql %}
+
+--RENAME table
+desc student;
Review comment:
DESC
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]