HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

SHOW CREATE TABLE

Function

Displays the CREATE TABLE statement to create the named table. This syntax can also be used to query view creation statements.

Precautions

  • This syntax does not support querying temporary tables.
  • The field character set and character order will be inherited from the table. the character set and character order of both the field and the table will be displayed in full in SHOW CREATE TABLE. If the default character set or character order of the table does not exist, when b_format_behavior_compat_options = 'default_collation', the character set and character order will be inherited from the current database's character set and its corresponding default character order, and no character set and character order will be inherited from the table when b_format_behavior_compat_options is not set. When b_format_behavior_compat_ is not set, no character set or character order is displayed.

Syntax

show create table tbl_name;

Parameter Description

  • tbl_name

    Table name.

Examples

MogDB=# CREATE TABLE t1 (c1 INT PRIMARY KEY);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE
MogDB=# show create table t1;
 Table |                      Create Table                       
-------+---------------------------------------------------------
 t1    | SET search_path = public;                              +
       | CREATE TABLE t1 (                                      +
       |     c1 integer NOT NULL                                +
       | )                                                      +
       | WITH (orientation=row, compression=no);                +
       | ALTER TABLE t1 ADD CONSTRAINT t1_pkey PRIMARY KEY (c1);
(1 row)
Copyright © 2011-2024 www.enmotech.com All rights reserved.