Server:CentOS Linux release 7.6.1810 (Core) (3.10.0-957.el7.x86_64)
openGauss:2.0.0 企业版 centos_x86_64
DataStudio:2.0.0 windows_x86_64
登录数据库
[omm@node1 ~]$ gsql -d postgres -p 26000 -E
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:04:03 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
postgres=# help
You are using gsql, the command-line interface to gaussdb.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with gsql commands
\g or terminate with semicolon to execute query
\q to quit
postgres=#
查看SQL命令的帮助信息
postgres=# \h
Available help:
ABORT CREATE BARRIER DROP MATERIALIZED VIEW
ALTER APP WORKLOAD GROUP CREATE CLIENT MASTER KEY DROP NODE
ALTER APP WORKLOAD GROUP MAPPING CREATE COLUMN ENCRYPTION KEY DROP NODE GROUP
ALTER AUDIT POLICY CREATE DATA SOURCE DROP OWNED
ALTER DATA SOURCE CREATE DATABASE DROP PROCEDURE
ALTER DATABASE CREATE DIRECTORY DROP RESOURCE LABEL
ALTER DEFAULT PRIVILEGES CREATE EXTENSION DROP RESOURCE POOL
ALTER DIRECTORY CREATE FOREIGN TABLE DROP ROLE
ALTER EXTENSION CREATE FUNCTION DROP ROW LEVEL SECURITY POLICY
ALTER FOREIGN TABLE CREATE GROUP DROP SCHEMA
ALTER FOREIGN TABLE FOR HDFS CREATE INDEX DROP SEQUENCE
ALTER FUNCTION CREATE MASKING POLICY DROP SERVER
ALTER GROUP CREATE MATERIALIZED VIEW DROP SYNONYM
ALTER INDEX CREATE NODE DROP TABLE
ALTER LARGE OBJECT CREATE NODE GROUP DROP TABLESPACE
ALTER MASKING POLICY CREATE PROCEDURE DROP TEXT SEARCH CONFIGURATION
ALTER NODE CREATE RESOURCE LABEL DROP TEXT SEARCH DICTIONARY
ALTER NODE GROUP CREATE RESOURCE POOL DROP TRIGGER
ALTER RESOURCE LABEL CREATE ROLE DROP TYPE
ALTER RESOURCE POOL CREATE ROW LEVEL SECURITY POLICY DROP USER
ALTER ROLE CREATE SCHEMA DROP VIEW
ALTER ROW LEVEL SECURITY POLICY CREATE SEQUENCE DROP WEAK PASSWORD DICTIONARY
ALTER SCHEMA CREATE SERVER DROP WORKLOAD GROUP
ALTER SEQUENCE CREATE SYNONYM END
ALTER SERVER CREATE TABLE EXECUTE
ALTER SESSION CREATE TABLE AS EXECUTE DIRECT
ALTER SYNONYM CREATE TABLE PARTITION EXPLAIN
ALTER SYSTEM KILL SESSION CREATE TABLESPACE FETCH
ALTER SYSTEM SET CREATE TEXT SEARCH CONFIGURATION GRANT
ALTER TABLE CREATE TEXT SEARCH DICTIONARY INSERT
ALTER TABLE PARTITION CREATE TRIGGER LOCK
ALTER TABLESPACE CREATE TYPE MERGE
ALTER TEXT SEARCH CONFIGURATION CREATE USER MOVE
ALTER TEXT SEARCH DICTIONARY CREATE VIEW PREPARE
ALTER TRIGGER CREATE WEAK PASSWORD DICTIONARY PREPARE TRANSACTION
ALTER TYPE CREATE WORKLOAD GROUP REASSIGN OWNED
ALTER USER CURSOR REFRESH MATERIALIZED VIEW
ALTER VIEW DEALLOCATE REINDEX
ALTER WORKLOAD GROUP DECLARE RESET
ANALYSE DELETE REVOKE
ANALYZE DO ROLLBACK
--More--
postgres-# \h create database
Command: CREATE DATABASE
Description: create a new database
Syntax:
CREATE DATABASE database_name
[ [ WITH ] {[ OWNER [=] user_name ]|
[ TEMPLATE [=] template ]|
[ ENCODING [=] encoding ]|
[ LC_COLLATE [=] lc_collate ]|
[ LC_CTYPE [=] lc_ctype ]|
[ DBCOMPATIBILITY [=] compatibility_type ]|
[ TABLESPACE [=] tablespace_name ]|
[ CONNECTION LIMIT [=] connlimit ]}[...] ];
查看元命令的帮助信息
postgres=# \?
General
\copyright show openGauss usage and distribution terms
\g [FILE] or ; execute query (and send results to file or |pipe)
\h(\help) [NAME] help on syntax of SQL commands, * for all commands
\parallel [on [num]|off] toggle status of execute (currently off)
\q quit gsql
Query Buffer
\e [FILE] [LINE] edit the query buffer (or file) with external editor
\ef [FUNCNAME [LINE]] edit function definition with external editor
\p show the contents of the query buffer
\r reset (clear) the query buffer
\w FILE write query buffer to file
Input/Output
\copy ... perform SQL COPY with data stream to the client host
\echo [STRING] write string to standard output
\i FILE execute commands from file
\i+ FILE KEY execute commands from encrypted file
\ir FILE as \i, but relative to location of current script
\ir+ FILE KEY as \i+, but relative to location of current script
\o [FILE] send all query results to file or |pipe
\qecho [STRING] write string to query output stream (see \o)
Informational
(options: S = show system objects, + = additional detail)
\d[S+] list tables, views, and sequences
\d[S+] NAME describe table, view, sequence, or index
\da[S] [PATTERN] list aggregates
\db[+] [PATTERN] list tablespaces
\dc[S+] [PATTERN] list conversions
\dC[+] [PATTERN] list casts
\dd[S] [PATTERN] show object descriptions not displayed elsewhere
\ddp [PATTERN] list default privileges
\dD[S+] [PATTERN] list domains
\ded[+] [PATTERN] list data sources
\det[+] [PATTERN] list foreign tables
\des[+] [PATTERN] list foreign servers
\deu[+] [PATTERN] list user mappings
\dew[+] [PATTERN] list foreign-data wrappers
\df[antw][S+] [PATRN] list [only agg/normal/trigger/window] functions
\dF[+] [PATTERN] list text search configurations
--More--
相关链接
欢迎各位同学一起来交流学习心得!
最后修改时间:2021-12-16 18:26:52
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。