暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

华为GaussDB A gsql获取帮助

墨天轮 2019-10-12
1284

获取帮助

操作步骤

  • 连接数据库时,可以使用如下命令获取帮助信息。
    gsql --help

    显示如下帮助信息:

    ...... Usage: gsql [OPTION]... [DBNAME [USERNAME]] General options: -c, --command=COMMAND run only single command (SQL or internal) and exit -d, --dbname=DBNAME database name to connect to (default: "postgres") -f, --file=FILENAME execute commands from file, then exit ......
  • 连接到数据库后,可以使用如下命令获取帮助信息。
    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

任务示例

  • 使用如下命令连接数据库。

    gsql -d postgres -p 25308

    postgres为需要连接的数据库名称,25308为CN的端口号。

    连接成功后,系统显示类似如下信息:

    gsql ((GaussDB Kernel V300R002C00 build 50dc16a6) compiled at 2019-01-29 05:49:21 commit 1071 last mr 1373) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. postgres=#

  • 查看gsql的帮助信息。具体执行命令请参见表1。

    表1 使用gsql联机帮助

    描述

    示例

    查看版权信息

    \copyright

    查看GaussDB 200支持的SQL语句的帮助

    查看GaussDB 200支持的SQL语句的帮助

    例如,查看GaussDB 200支持的所有SQL语句:

    1
    2
    3
    4
    5
    6
    \h
    Available help:
      ABORT                            
      ALTER AGGREGATE
      ALTER APP WORKLOAD GROUP                  
    ... ...
    

    例如,查看CREATE DATABASE命令的参数可使用下面的命令:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    \help 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 ]}[...] ];
    

    查看gsql命令的帮助

    例如,查看gsql支持的命令:

    1
    2
    3
    4
    5
    6
    7
    \?
    General
      \copyright             show PostgreSQL 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
      \q                     quit gsql
    ... ...
    


查看更多:华为GaussDB 200 gsql
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论