[postgres@cqbm301017:5779/(rasesql)postgres][03-06.17:22:51]M=# \h create table
Command: CREATE TABLE
Description: define a new table
Syntax:
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXISTS ] table_name ( [
{ column_name data_type [ COLLATE collation ] [ COMPRESSION compression_method ] [ column_constraint [ ... ] ]
| table_constraint
| LIKE source_table [ like_option ... ] }
[, ... ]
] )
实例:
CREATE TABLE public.test (
created_by character varying(100) COMPRESSION pglz,
created_date timestamp without time zone,
updated_by character varying(100) COMPRESSION pglz,
updated_date timestamp without time zone,
id_test_qual_leak character varying(32) COMPRESSION pglz,
id_test_quality_case character varying(32) COMPRESSION pglz,
test_qual_link character varying(2) COMPRESSION pglz,
id_leak_qual_link character varying(32) COMPRESSION pglz,
link_leak_total_amount bigint,
link_project_type character varying(50) COMPRESSION pglz
);
PG11 建表语法
[postgres@ ~/lxm/v2]$ psql
psql (11.5)
Type "help" for help.