进入psql命令行环境,可以使用的SQL命令如下:
pgdb=# \help
可用帮助:
ABORT CREATE LANGUAGE DROP VIEW
ALTER AGGREGATE CREATE OPERATOR CLASS END
ALTER CONVERSION CREATE OPERATOR EXECUTE
ALTER DATABASE CREATE ROLE EXPLAIN
ALTER DOMAIN CREATE RULE FETCH
ALTER FUNCTION CREATE SCHEMA GRANT
ALTER GROUP CREATE SEQUENCE INSERT
ALTER INDEX CREATE TABLE LISTEN
ALTER LANGUAGE CREATE TABLE AS LOAD
ALTER OPERATOR CLASS CREATE TABLESPACE LOCK
ALTER OPERATOR CREATE TRIGGER MOVE
ALTER ROLE CREATE TYPE NOTIFY
ALTER SCHEMA CREATE USER PREPARE
ALTER SEQUENCE CREATE VIEW PREPARE TRANSACTION
ALTER TABLE DEALLOCATE REINDEX
ALTER TABLESPACE DECLARE RELEASE SAVEPOINT
ALTER TRIGGER DELETE RESET
ALTER TYPE DROP AGGREGATE REVOKE
ALTER USER DROP CAST ROLLBACK
ANALYZE DROP CONVERSION ROLLBACK PREPARED
BEGIN DROP DATABASE ROLLBACK TO SAVEPOINT
CHECKPOINT DROP DOMAIN SAVEPOINT
CLOSE DROP FUNCTION SELECT
CLUSTER DROP GROUP SELECT INTO
COMMENT DROP INDEX SET
COMMIT DROP LANGUAGE SET CONSTRAINTS
COMMIT PREPARED DROP OPERATOR CLASS SET ROLE
COPY DROP OPERATOR SET SESSION AUTHORIZATION
CREATE AGGREGATE DROP ROLE SET TRANSACTION
CREATE CAST DROP RULE SHOW
CREATE CONSTRAINT TRIGGER DROP SCHEMA START TRANSACTION
CREATE CONVERSION DROP SEQUENCE TRUNCATE
CREATE DATABASE DROP TABLE UNLISTEN
CREATE DOMAIN DROP TABLESPACE UPDATE
CREATE FUNCTION DROP TRIGGER VACUUM
CREATE GROUP DROP TYPE
CREATE INDEX DROP USER比如,要获得SQL命令create database的帮助,则输出如下信息:
pgdb=# \help create database
命令: CREATE DATABASE
描述: 创建一个新的数据库
语法:
CREATE DATABASE name
[ [ WITH ] [ OWNER [=] dbowner ]
[ TEMPLATE [=] template ]
[ ENCODING [=] encoding ]
[ TABLESPACE [=] tablespace ]
[ CONNECTION LIMIT [=] connlimit ] ]
pgdb=#