PostgreSQL命令语法大全

可以使用help语句查看所有postgreSQL语句的语法。 按照以下步骤查看PostgreSQL中所有语句的语法。

  • 安装postgreSQL后,打开psql为:程序文件 -> PostgreSQL 9.2 -> SQL Shell(psql)
  • 使用以下语句查看特定语句的语法。 postgres-#\ help&

PostgreSQL语句

在这里,我们提供了所有postgreSQL语句及其语法的列表:

ABORT语句:

语法:

ABORT [ WORK | TRANSACTION ]

ALTER AGGREGATE语句:

语法:

ALTER AGGREGATE name ( type ) RENAME TO new_name  
ALTER AGGREGATE name ( type ) OWNER TO new_owner
ALTER CONVERSION语句:

语法:

ALTER CONVERSION name RENAME TO new_name  
ALTER CONVERSION name OWNER TO new_owner

ALTER DATABASE语句:

语法:

ALTER DATABASE name SET parameter { TO | = } { value | DEFAULT }  
ALTER DATABASE name RESET parameter  
ALTER DATABASE name RENAME TO new_name  
ALTER DATABASE name OWNER TO new_owner
ALTER DOMAIN语句:

语法:

ALTER DOMAIN name { SET DEFAULT expression | DROP DEFAULT }  
ALTER DOMAIN name { SET | DROP } NOT NULL  
ALTER DOMAIN name ADD domain_constraint  
ALTER DOMAIN name DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]  
ALTER DOMAIN name OWNER TO new_owner
ALTER FUNCTION语句:

语法:

ALTER FUNCTION name ( [ type [, ...] ] ) RENAME TO new_name  
ALTER FUNCTION name ( [ type [, ...] ] ) OWNER TO new_owner

ALTER GROUP语句:

语法:

ALTER GROUP groupname ADD USER username [, ... ]  
ALTER GROUP groupname DROP USER username [, ... ]  
ALTER GROUP groupname RENAME TO new_name

ALTER INDEX语句:

语法:

ALTER INDEX name OWNER TO new_owner  
ALTER INDEX name SET TABLESPACE indexspace_name  
ALTER INDEX name RENAME TO new_name
ALTER LANGUAGE语句:

语法:

ALTER LANGUAGE name RENAME TO new_name
ALTER OPERATOR语句:

语法:

ALTER OPERATOR name ( { lefttype | NONE } , { righttype | NONE } )  
OWNER TO new_owner
ALTER OPERATOR CLASS语句:

语法:

ALTER OPERATOR CLASS name USING index_method RENAME TO new_name  
ALTER OPERATOR CLASS name USING index_method OWNER TO new_owner
ALTER SCHEMA语句:

语法:

ALTER SCHEMA name RENAME TO new_name  
ALTER SCHEMA name OWNER TO new_owner
ALTER SEQUENCE语句:

语法:

ALTER SEQUENCE name [ INCREMENT [ BY ] increment ]  
[ MINVALUE minvalue | NO MINVALUE ]  
[ MAXVALUE maxvalue | NO MAXVALUE ]  
[ RESTART [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]

ALTER TABLE语句:

语法:

ALTER TABLE [ ONLY ] name [ * ]  
action [, ... ]  
ALTER TABLE [ ONLY ] name [ * ]  
RENAME [ COLUMN ] column TO new_column  
ALTER TABLE name  
RENAME TO new_name
联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2024

备案号:京ICP备15003423号-3