Help Center > > Developer Guide> Database Quick Start> Creating and Managing Tables> Viewing Data in a Table

Viewing Data in a Table

Updated at: Mar 13, 2020 GMT+08:00
  • Run the following command to query information about all tables in a database in the system catalog pg_tables:
    1
    SELECT * FROM pg_tables;
    
  • Run the \d+ command of the gsql tool to query table attributes:
    1
    \d+ customer_t1;
    
  • Run the following command to query the data volume of table customer_t1:
    1
    SELECT count(*) FROM customer_t1;
    
  • Run the following command to query all data in table customer_t1:
    1
    SELECT * FROM customer_t1;
    
  • Run the following command to query data in column c_customer_sk:
    1
    SELECT c_customer_sk FROM customer_t1;
    
  • Run the following command to filter repeated data in column c_customer_sk:
    1
    SELECT DISTINCT( c_customer_sk ) FROM customer_t1;
    
  • Run the following command to query all data whose column c_customer_sk is 3869:
    1
    SELECT * FROM customer_t1 WHERE c_customer_sk = 3869;
    
  • Run the following command to sort data based on column c_customer_sk.
    1
    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.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel