0001 ---
0002 layout: global
0003 title: SHOW CREATE TABLE
0004 displayTitle: SHOW CREATE TABLE
0005 license: |
0006 Licensed to the Apache Software Foundation (ASF) under one or more
0007 contributor license agreements. See the NOTICE file distributed with
0008 this work for additional information regarding copyright ownership.
0009 The ASF licenses this file to You under the Apache License, Version 2.0
0010 (the "License"); you may not use this file except in compliance with
0011 the License. You may obtain a copy of the License at
0012
0013 http://www.apache.org/licenses/LICENSE-2.0
0014
0015 Unless required by applicable law or agreed to in writing, software
0016 distributed under the License is distributed on an "AS IS" BASIS,
0017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0018 See the License for the specific language governing permissions and
0019 limitations under the License.
0020 ---
0021
0022 ### Description
0023
0024 `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.
0025
0026 ### Syntax
0027
0028 ```sql
0029 SHOW CREATE TABLE table_identifier
0030 ```
0031
0032 ### Parameters
0033
0034 * **table_identifier**
0035
0036 Specifies a table or view name, which may be optionally qualified with a database name.
0037
0038 **Syntax:** `[ database_name. ] table_name`
0039
0040 ### Examples
0041
0042 ```sql
0043 CREATE TABLE test (c INT) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
0044 STORED AS TEXTFILE
0045 TBLPROPERTIES ('prop1' = 'value1', 'prop2' = 'value2');
0046
0047 SHOW CREATE TABLE test;
0048 +----------------------------------------------------+
0049 | createtab_stmt|
0050 +----------------------------------------------------+
0051 |CREATE TABLE `default`.`test` (`c` INT)
0052 USING text
0053 TBLPROPERTIES (
0054 'transient_lastDdlTime' = '1586269021',
0055 'prop1' = 'value1',
0056 'prop2' = 'value2')
0057 +----------------------------------------------------+
0058 ```
0059
0060 ### Related Statements
0061
0062 * [CREATE TABLE](sql-ref-syntax-ddl-create-table.html)
0063 * [CREATE VIEW](sql-ref-syntax-ddl-create-view.html)