SHOW CREATE TABLE
功能描述
显示创建表 tbl_name
显示CREATE TABLE创建命名表的语句。 此语法也可用于查询视图(view)的创建语句。
注意事项
- 此语法不支持查询临时表。
- 字段字符集和字符序将从表上继承,字段和表的字符集、字符序在SHOW CREATE TABLE中均会全部显示。若表的默认字符集或字符序不存在,当b_format_behavior_compat_options = ‘default_collation’时,字符集和字符序将继承当前数据库的字符集及其对应的默认字符序,未设置b_format_behavior_compat_options时,无字符集和字符序显示。
语法格式
1. show create table tbl_name;
参数说明
- tbl_name
表名。
示例
1. openGauss=# CREATE TABLE t1 (c1 INT PRIMARY KEY);
2. NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
3. CREATE TABLE
4. openGauss=# show create table t1;
5. Table | Create Table
6. -------+---------------------------------------------------------
7. t1 | SET search_path = public; +
8. | CREATE TABLE t1 ( +
9. | c1 integer NOT NULL +
10. | ) +
11. | WITH (orientation=row, compression=no); +
12. | ALTER TABLE t1 ADD CONSTRAINT t1_pkey PRIMARY KEY (c1);
13. (1 row)
