GBase 8c
其他
文章

GBase 8c查看数据

发表于2023-12-06 17:12:36137次浏览1个评论
  • 使用系统表pg_tables查询数据库所有表的信息。

gbase=# SELECT * FROM pg_tables;

  • 使用gsql的\d+命令查询表的属性。

gbase=# \d+ customer_t1;

  • 执行如下命令查询表customer_t1的数据量。

gbase=# SELECT count(*) FROM customer_t1;

  • 执行如下命令查询表customer_t1的所有数据。

gbase=# SELECT * FROM customer_t1;

  • 执行如下命令只查询字段c_customer_sk的数据。

gbase=# SELECT c_customer_sk FROM customer_t1;

  • 执行如下命令过滤字段c_customer_sk的重复数据。

gbase=# SELECT DISTINCT( c_customer_sk ) FROM customer_t1;

  • 执行如下命令查询字段c_customer_sk为3869的所有数据。

gbase=# SELECT * FROM customer_t1 WHERE c_customer_sk = 3869;

  • 执行如下命令按照字段c_customer_sk进行排序。

gbase=# SELECT * FROM customer_t1 ORDER BY c_customer_sk;

评论

登录后才可以发表评论
崔哥发表于 6个月前
墙角数枝梅,凌寒独自开。遥知不是雪,为有暗香来。