Viewing Data

  • 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 the table customer_t1:

    SELECT * FROM customer_t1;
    
  • Run the following command to query only the data in the column c_customer_sk:

    SELECT c_customer_sk FROM customer_t1;
    
  • Run the following command to filter repeated data in the 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 collate data based on the column c_customer_sk:

    SELECT * FROM customer_t1 ORDER BY c_customer_sk;
    
Feedback
编组 3备份
    openGauss 2024-10-14 01:18:03
    cancel