• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. Database Quick Start
  5. Creating and Managing Tables
  6. Viewing Data in a Table

Viewing Data in a Table

  • Run the following command to query information about all tables in a database in the system catalog pg_tables:
    SELECT * FROM pg_tables;
  • Run the \d+ command of the gsql tool to query table attributes:
    \d+ customer_t1;
  • Run the following command to query the data volume of table customer_t1:
    SELECT count(*) FROM customer_t1;
  • Run the following command to query all data in table customer_t1:
    SELECT * FROM customer_t1;
  • Run the following command to query data in column c_customer_sk:
    SELECT c_customer_sk FROM customer_t1;
  • Run the following command to filter repeated data in column c_customer_sk:
    SELECT DISTINCT( c_customer_sk ) FROM customer_t1;
  • Run the following command to query all data whose column c_customer_sk is 3869:
    SELECT * FROM customer_t1 WHERE c_customer_sk = 3869;
  • Run the following command to sort data based on column c_customer_sk.
    SELECT * FROM customer_t1 ORDER BY c_customer_sk;

    For details about how to cancel the query that has been running for a long time, see Viewing and Stopping the Running Query Statements.