Syntax

By default, after you log in to the installed database, you can run the \help statement to view syntax of all openGauss statements.

openGauss=# \help
Available help:
ABORT                             ALTER TABLE                       CREATE DATABASE                   CREATE TEXT SEARCH CONFIGURATION  DROP OPERATOR                     MERGE
  ALTER APP WORKLOAD GROUP          ALTER TABLE PARTITION             CREATE DIRECTORY                  CREATE TEXT SEARCH DICTIONARY     DROP OWNED                        MOVE
  ALTER APP WORKLOAD GROUP MAPPING  ALTER TABLESPACE                  CREATE EXTENSION                  CREATE TRIGGER                    DROP PACKAGE                      PREPARE
  ALTER AUDIT POLICY                ALTER TEXT SEARCH CONFIGURATION   CREATE FOREIGN TABLE              CREATE TYPE                       DROP PACKAGE BODY                 PREPARE TRANSACTION
  ALTER DATA SOURCE                 ALTER TEXT SEARCH DICTIONARY      CREATE FUNCTION                   CREATE USER                       DROP PROCEDURE                    PUBLISH SNAPSHOT
  ALTER DATABASE                    ALTER TRIGGER                     CREATE GROUP                      CREATE VIEW                       DROP RESOURCE LABEL               PURGE SNAPSHOT
  ALTER DEFAULT PRIVILEGES          ALTER TYPE                        CREATE INDEX                      CREATE WEAK PASSWORD DICTIONARY   DROP RESOURCE POOL                REASSIGN OWNED
  ALTER DIRECTORY                   ALTER USER                        CREATE LANGUAGE                   CREATE WORKLOAD GROUP             DROP ROLE                         REFRESH MATERIALIZED VIEW
  ALTER EXTENSION                   ALTER VIEW                        CREATE MASKING POLICY             CURSOR                            DROP ROW LEVEL SECURITY POLICY    REINDEX
  ALTER FOREIGN TABLE               ALTER WORKLOAD GROUP              CREATE MATERIALIZED VIEW          DEALLOCATE                        DROP SCHEMA                       RESET
  ALTER FOREIGN TABLE FOR HDFS      ANALYSE                           CREATE MODEL                      DECLARE                           DROP SEQUENCE                     REVOKE
  ALTER FUNCTION                    ANALYZE                           CREATE NODE                       DELETE                            DROP SERVER                       ROLLBACK
  ALTER GROUP                       ANONYMOUS BLOCK                   CREATE NODE GROUP                 DO                                DROP SYNONYM                      ROLLBACK PREPARED
  ALTER INDEX                       ARCHIVE SNAPSHOT                  CREATE OPERATOR                   DROP APP WORKLOAD GROUP           DROP TABLE                        SAMPLE SNAPSHOT
  ALTER LARGE OBJECT                BEGIN                             CREATE PACKAGE                    DROP APP WORKLOAD GROUP MAPPING   DROP TABLESPACE                   SAVEPOINT
  ALTER MASKING POLICY              CALL                              CREATE PACKAGE BODY               DROP AUDIT POLICY                 DROP TEXT SEARCH CONFIGURATION    SELECT
  ALTER MATERIALIZED VIEW           CHECKPOINT                        CREATE PROCEDURE                  DROP CLIENT MASTER KEY            DROP TEXT SEARCH DICTIONARY       SELECT INTO
  ALTER NODE                        CLEAN CONNECTION                  CREATE RESOURCE LABEL             DROP COLUMN ENCRYPTION KEY        DROP TRIGGER                      SET
  ALTER NODE GROUP                  CLOSE                             CREATE RESOURCE POOL              DROP DATA SOURCE                  DROP TYPE                         SET CONSTRAINTS
  ALTER OPERATOR                    CLUSTER                           CREATE ROLE                       DROP DATABASE                     DROP USER                         SET ROLE
  ALTER RESOURCE LABEL              COMMENT                           CREATE ROW LEVEL SECURITY POLICY  DROP DIRECTORY                    DROP VIEW                         SET SESSION AUTHORIZATION
  ALTER RESOURCE POOL               COMMIT                            CREATE SCHEMA                     DROP EXTENSION                    DROP WEAK PASSWORD DICTIONARY     SET TRANSACTION
  ALTER ROLE                        COMMIT PREPARED                   CREATE SEQUENCE                   DROP FOREIGN TABLE                DROP WORKLOAD GROUP               SHOW
  ALTER ROW LEVEL SECURITY POLICY   COPY                              CREATE SERVER                     DROP FUNCTION                     END                               START TRANSACTION
  ALTER SCHEMA                      CREATE APP WORKLOAD GROUP         CREATE SNAPSHOT AS                DROP GROUP                        EXECUTE                           TRUNCATE
  ALTER SEQUENCE                    CREATE APP WORKLOAD GROUP MAPPING CREATE SNAPSHOT FROM              DROP INDEX                        EXECUTE DIRECT                    UPDATE
  ALTER SERVER                      CREATE AUDIT POLICY               CREATE SYNONYM                    DROP MASKING POLICY               EXPLAIN                           VACUUM
  ALTER SESSION                     CREATE BARRIER                    CREATE TABLE                      DROP MATERIALIZED VIEW            FETCH                             VALUES
  ALTER SYNONYM                     CREATE CLIENT MASTER KEY          CREATE TABLE AS                   DROP MODEL                        GRANT
  ALTER SYSTEM KILL SESSION         CREATE COLUMN ENCRYPTION KEY      CREATE TABLE PARTITION            DROP NODE                         INSERT
  ALTER SYSTEM SET                  CREATE DATA SOURCE                CREATE TABLESPACE                 DROP NODE GROUP                   LOCK

You can run the **\h **name command to view detailed syntax information. For example:

openGauss=# \h ABORT
Command:     ABORT
Description: abort the current transaction
Syntax:
ABORT [ WORK | TRANSACTION ] ;

SQL Statements

An SQL statement usually contains keywords, identifiers (columns), constants, and special characters. For example, a simple SQL statement is as follows:

SELECT id, name FROM t1;

-

SELECT

id, name

FROM

t1

Type

Keyword

Identifiers (columns)

Keyword

Identifier

Description

Command

Columns id and name

Statement, which is used to set conditions, rules, or others.

Table name

For details about the SQL syntax, see Appendix: SQL Syntax.

Feedback
编组 3备份
    openGauss 2024-11-22 00:52:56
    cancel