Skip to content

Commit

Permalink
[SPARK-28813][DOC][SQL] Document SHOW CREATE TABLE in SQL Reference
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Document SHOW CREATE TABLE statement in SQL Reference

### Why are the changes needed?
To complete the SQL reference.

### Does this PR introduce any user-facing change?
Yes.

after the change:

![image](https://user-images.githubusercontent.com/13592258/66239427-b2349800-e6ae-11e9-8f78-f9e8ed85ab3b.png)

### How was this patch tested?
Tested using jykyll build --serve

Closes #25885 from huaxingao/spark-28813.

Authored-by: Huaxin Gao <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
  • Loading branch information
huaxingao authored and srowen committed Oct 4, 2019
1 parent 130e9ae commit 228b1ea
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion docs/sql-ref-syntax-aux-show-create-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,46 @@ license: |
limitations under the License.
---

**This page is under construction**
### Description
`SHOW CREATE TABLE` returns the [CREATE TABLE statement](sql-ref-syntax-ddl-create-table.html) or [CREATE VIEW statement](sql-ref-syntax-ddl-create-view.html) that was used to create a given table or view. `SHOW CREATE TABLE` on a non-existent table or a temporary view throws an exception.

### Syntax
{% highlight sql %}
SHOW CREATE TABLE name
{% endhighlight %}

### Parameters
<dl>
<dt><code><em>name</em></code></dt>
<dd>The name of the table or view to be used for SHOW CREATE TABLE.</dd>
</dl>

### Examples
{% highlight sql %}
CREATE TABLE test (c INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE
TBLPROPERTIES ('prop1' = 'value1', 'prop2' = 'value2');

show create table test;

-- the result of SHOW CREATE TABLE test
CREATE TABLE `test`(`c` INT)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'field.delim' = ',',
'serialization.format' = ','
)
STORED AS
INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
TBLPROPERTIES (
'transient_lastDdlTime' = '1569350233',
'prop1' = 'value1',
'prop2' = 'value2'
)

{% endhighlight %}

### Related Statements
* [CREATE TABLE](sql-ref-syntax-ddl-create-table.html)
* [CREATE VIEW](sql-ref-syntax-ddl-create-view.html)

0 comments on commit 228b1ea

Please sign in to comment.