gsql工具提供了若干高级特性,便于用户使用。常见用法如下:
查看命令帮助信息
""
\h [NAME]
复制例如,查询ABORT的所有语法。
""
openGauss=# \h ABORT Command: ABORT Description: abort the current transaction Syntax: ABORT [ WORK | TRANSACTION ] ;
复制切换数据库
""
\c dbname
复制例如,将postgres数据库切换为数据库dp_tpcc。
""
openGauss=# \c db_tpcc Non-SSL connection (SSL connection is recommended when requiring high-security) You are now connected to database "db_tpcc" as user "omm". db_tpcc=#
复制查询所有数据库
""
\l
复制示例如下。
""
openGauss=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+-------+-----------+---------+-------+------------------- mydb | omm | GBK | C | C | postgres | omm | SQL_ASCII | C | C | template0 | omm | SQL_ASCII | C | C | =c/omm + | | | | | omm=CTc/omm template1 | omm | SQL_ASCII | C | C | =c/omm + | | | | | omm=CTc/omm (4 rows)
复制查询当前数据库中的所有表
""
\dt
复制示例如下。
""
openGauss=# \dt List of relations Schema | Name | Type | Owner | Storage --------+-----------------+-------+-------+---------------------------------- public | customer_t1 | table | omm | {orientation=row,compression=no} public | customer_t1_bak | table | omm | {orientation=row,compression=no} (2 rows)
复制查看表结构
""
\d tablename
复制例如,查看表customer_t1的表结构。
""
openGauss=# \d customer_t1 Table "public.customer_t1" Column | Type | Modifiers ---------------+--------------+----------- c_customer_sk | integer | c_customer_id | character(5) | c_first_name | character(6) | c_last_name | character(8) | amount | integer |
复制
最后修改时间:2022-11-25 16:41:02
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
2025年3月国产数据库大事记
墨天轮编辑部
897次阅读
2025-04-03 15:21:16
MogDB 发布更新,解决 openGauss 数据库在长事务情况下Ustore表膨胀问题
MogDB
289次阅读
2025-04-17 10:41:41
openGauss 7.0.0-RC1 版本正式发布!
Gauss松鼠会
207次阅读
2025-04-01 12:27:03
MogDB 发布更新,解决 openGauss 数据库在长事务情况下Ustore表膨胀问题
云和恩墨
190次阅读
2025-04-16 09:52:02
openGauss 7.0.0-RC1 版本体验:一主一备快速安装指南
孙莹
183次阅读
2025-04-01 10:30:07
鲲鹏RAG一体机解决方案正式发布 openGauss DataVec向量数据库助力DeepSeek行业应用
Gauss松鼠会
125次阅读
2025-03-31 10:00:29
荣誉时刻!openGauss认证证书快递已发,快来看看谁榜上有名!
墨天轮小教习
115次阅读
2025-04-23 17:39:13
GitCode 成 openGauss 新归宿,国产开源数据库里程碑事件
严少安
84次阅读
2025-04-27 11:37:53
openGauss6.0.0适配操作系统自带的软件,不依赖三方库
来杯拿铁
78次阅读
2025-04-18 10:49:53
opengauss使用gs_probackup进行增量备份恢复
进击的CJR
70次阅读
2025-04-09 16:11:58