SQL Syntax Summary

    See for more information.

    ALTER AGGREGATE

    Changes the definition of an aggregate function

    1. ALTER AGGREGATE <name> ( <type> [ , ... ] ) OWNER TO <new_owner>
    2. ALTER AGGREGATE <name> ( <type> [ , ... ] ) SET SCHEMA <new_schema>

    See for more information.

    ALTER CONVERSION

    Changes the definition of a conversion.

    1. ALTER CONVERSION <name> RENAME TO <newname>
    2. ALTER CONVERSION <name> OWNER TO <newowner>

    See for more information.

    ALTER DATABASE

    Changes the attributes of a database.

    1. ALTER DATABASE <name> [ WITH CONNECTION LIMIT <connlimit> ]
    2. ALTER DATABASE <name> SET <parameter> { TO | = } { <value> | DEFAULT }
    3. ALTER DATABASE <name> RESET <parameter>
    4. ALTER DATABASE <name> RENAME TO <newname>
    5. ALTER DATABASE <name> OWNER TO <new_owner>

    See for more information.

    ALTER DOMAIN

    Changes the definition of a domain.

    1. ALTER DOMAIN <name> { SET DEFAULT <expression> | DROP DEFAULT }
    2. ALTER DOMAIN <name> { SET | DROP } NOT NULL
    3. ALTER DOMAIN <name> ADD <domain_constraint>
    4. ALTER DOMAIN <name> DROP CONSTRAINT <constraint_name> [RESTRICT | CASCADE]
    5. ALTER DOMAIN <name> OWNER TO <new_owner>
    6. ALTER DOMAIN <name> SET SCHEMA <new_schema>

    See for more information.

    ALTER EXTENSION

    Change the definition of an extension that is registered in a Greenplum database.

    1. ALTER EXTENSION <name> UPDATE [ TO <new_version> ]
    2. ALTER EXTENSION <name> SET SCHEMA <new_schema>
    3. ALTER EXTENSION <name> ADD <member_object>
    4. ALTER EXTENSION <name> DROP <member_object>
    5. where <member_object> is:
    6. ACCESS METHOD <object_name> |
    7. AGGREGATE <aggregate_name> ( <aggregate_signature> ) |
    8. CAST (<source_type> AS <target_type>) |
    9. COLLATION <object_name> |
    10. CONVERSION <object_name> |
    11. DOMAIN <object_name> |
    12. EVENT TRIGGER <object_name> |
    13. FOREIGN DATA WRAPPER <object_name> |
    14. FOREIGN TABLE <object_name> |
    15. FUNCTION <function_name> ( [ [ <argmode> ] [ <argname> ] <argtype> [, ...] ] ) |
    16. MATERIALIZED VIEW <object_name> |
    17. OPERATOR <operator_name> (<left_type>, <right_type>) |
    18. OPERATOR CLASS <object_name> USING <index_method> |
    19. OPERATOR FAMILY <object_name> USING <index_method> |
    20. [ PROCEDURAL ] LANGUAGE <object_name> |
    21. SCHEMA <object_name> |
    22. SEQUENCE <object_name> |
    23. SERVER <object_name> |
    24. TABLE <object_name> |
    25. TEXT SEARCH CONFIGURATION <object_name> |
    26. TEXT SEARCH DICTIONARY <object_name> |
    27. TEXT SEARCH PARSER <object_name> |
    28. TEXT SEARCH TEMPLATE <object_name> |
    29. TRANSFORM FOR <type_name> LANGUAGE <lang_name> |
    30. TYPE <object_name> |
    31. VIEW <object_name>
    32. and <aggregate_signature> is:
    33. * | [ <argmode> ] [ <argname> ] <argtype> [ , ... ] |
    34. [ [ <argmode> ] [ <argname> ] <argtype> [ , ... ] ]
    35. ORDER BY [ <argmode> ] [ <argname> ] <argtype> [ , ... ]

    See for more information.

    ALTER EXTERNAL TABLE

    Changes the definition of an external table.

    1. ALTER EXTERNAL TABLE <name> <action> [, ... ]

    where action is one of:

    1. ADD [COLUMN] <new_column> <type>
    2. DROP [COLUMN] <column> [RESTRICT|CASCADE]
    3. ALTER [COLUMN] <column> TYPE <type> [USING <expression>]
    4. OWNER TO <new_owner>

    See for more information.

    ALTER FILESPACE

    Changes the definition of a filespace.

    1. ALTER FILESPACE <name> RENAME TO <newname>
    2. ALTER FILESPACE <name> OWNER TO <newowner>

    See for more information.

    ALTER FUNCTION

    Changes the definition of a function.

    1. ALTER FUNCTION <name> ( [ [<argmode>] [<argname>] <argtype> [, ...] ] )
    2. <action> [, ... ] [RESTRICT]
    3. ALTER FUNCTION <name> ( [ [<argmode>] [<argname>] <argtype> [, ...] ] )
    4. RENAME TO <new_name>
    5. ALTER FUNCTION <name> ( [ [<argmode>] [<argname>] <argtype> [, ...] ] )
    6. OWNER TO <new_owner>
    7. ALTER FUNCTION <name> ( [ [<argmode>] [<argname>] <argtype> [, ...] ] )
    8. SET SCHEMA <new_schema>

    See for more information.

    ALTER GROUP

    Changes a role name or membership.

    1. ALTER GROUP <groupname> ADD USER <username> [, ... ]
    2. ALTER GROUP <groupname> DROP USER <username> [, ... ]
    3. ALTER GROUP <groupname> RENAME TO <newname>

    See for more information.

    ALTER INDEX

    Changes the definition of an index.

    1. ALTER INDEX <name> RENAME TO <new_name>
    2. ALTER INDEX <name> SET TABLESPACE <tablespace_name>
    3. ALTER INDEX <name> SET ( FILLFACTOR = <value> )
    4. ALTER INDEX <name> RESET ( FILLFACTOR )

    See for more information.

    ALTER LANGUAGE

    Changes the name of a procedural language.

    1. ALTER LANGUAGE <name> RENAME TO <newname>
    2. ALTER LANGUAGE <name> OWNER TO <new_owner>

    See for more information.

    ALTER OPERATOR

    Changes the definition of an operator.

    1. ALTER OPERATOR <name> ( {<lefttype> | NONE} , {<righttype> | NONE} )
    2. OWNER TO <newowner>

    See for more information.

    ALTER OPERATOR CLASS

    Changes the definition of an operator class.

    1. ALTER OPERATOR CLASS <name> USING <index_method> RENAME TO <newname>
    2. ALTER OPERATOR CLASS <name> USING <index_method> OWNER TO <newowner>

    See for more information.

    ALTER OPERATOR FAMILY

    Changes the definition of an operator family.

    1. ALTER OPERATOR FAMILY <name> USING <index_method> ADD
    2. { OPERATOR <strategy_number> <operator_name> ( <op_type>, <op_type> ) [ RECHECK ]
    3. | FUNCTION <support_number> [ ( <op_type> [ , <op_type> ] ) ] <funcname> ( <argument_type> [, ...] )
    4. } [, ... ]
    5. ALTER OPERATOR FAMILY <name> USING <index_method> DROP
    6. { OPERATOR s<trategy_number> ( <op_type>, <op_type> )
    7. | FUNCTION <support_number> [ ( <op_type> [ , <op_type> ] )
    8. } [, ... ]
    9. ALTER OPERATOR FAMILY <name> USING <index_method> RENAME TO <newname>
    10. ALTER OPERATOR FAMILY <name> USING <index_method> OWNER TO <newowner>

    See for more information.

    ALTER PROTOCOL

    Changes the definition of a protocol.

    1. ALTER PROTOCOL <name> RENAME TO <newname>
    2. ALTER PROTOCOL <name> OWNER TO <newowner>

    See for more information.

    ALTER RESOURCE GROUP

    Changes the limits of a resource group.

    1. ALTER RESOURCE GROUP <name> SET <group_attribute> <value>

    See for more information.

    ALTER RESOURCE QUEUE

    Changes the limits of a resource queue.

    1. ALTER RESOURCE QUEUE <name> WITH ( <queue_attribute>=<value> [, ... ] )

    See for more information.

    ALTER ROLE

    Changes a database role (user or group).

    1. ALTER ROLE <name> RENAME TO <newname>
    2. ALTER ROLE <name> SET <config_parameter> {TO | =} {<value> | DEFAULT}
    3. ALTER ROLE <name> RESET <config_parameter>
    4. ALTER ROLE <name> RESOURCE QUEUE {<queue_name> | NONE}
    5. ALTER ROLE <name> RESOURCE GROUP {<group_name> | NONE}
    6. ALTER ROLE <name> [ [WITH] <option> [ ... ] ]

    See for more information.

    ALTER SCHEMA

    Changes the definition of a schema.

    1. ALTER SCHEMA <name> RENAME TO <newname>
    2. ALTER SCHEMA <name> OWNER TO <newowner>

    See for more information.

    ALTER SEQUENCE

    Changes the definition of a sequence generator.

    1. ALTER SEQUENCE <name> [INCREMENT [ BY ] <increment>]
    2. [MINVALUE <minvalue> | NO MINVALUE]
    3. [MAXVALUE <maxvalue> | NO MAXVALUE]
    4. [RESTART [ WITH ] <start>]
    5. [CACHE <cache>] [[ NO ] CYCLE]
    6. [OWNED BY {<table.column> | NONE}]
    7. ALTER SEQUENCE <name> RENAME TO new\_name
    8. ALTER SEQUENCE <name> SET SCHEMA <new_schema>

    See for more information.

    ALTER TABLE

    Changes the definition of a table.

    1. ALTER TABLE [ONLY] <name> RENAME [COLUMN] <column> TO <new_column>
    2. ALTER TABLE <name> RENAME TO <new_name>
    3. ALTER TABLE <name> SET SCHEMA <new_schema>
    4. ALTER TABLE [ONLY] <name> SET
    5. DISTRIBUTED BY (<column>, [ ... ] )
    6. | DISTRIBUTED RANDOMLY
    7. | WITH (REORGANIZE=true|false)
    8. ALTER TABLE [ONLY] <name> <action> [, ... ]
    9. ALTER TABLE <name>
    10. [ ALTER PARTITION { <partition_name> | FOR (RANK(<number>))
    11. | FOR (<value>) } [...] ] <partition_action>
    12. where <action> is one of:
    13. ADD [COLUMN] <column_name data_type> [ DEFAULT <default_expr> ]
    14. [<column_constraint> [ ... ]]
    15. [ ENCODING ( <storage_directive> [,...] ) ]
    16. DROP [COLUMN] <column> [RESTRICT | CASCADE]
    17. ALTER [COLUMN] <column> TYPE <type> [USING <expression>]
    18. ALTER [COLUMN] <column> SET DEFAULT <expression>
    19. ALTER [COLUMN] <column> DROP DEFAULT
    20. ALTER [COLUMN] <column> { SET | DROP } NOT NULL
    21. ALTER [COLUMN] <column> SET STATISTICS <integer>
    22. ADD <table_constraint>
    23. DROP CONSTRAINT <constraint_name> [RESTRICT | CASCADE]
    24. DISABLE TRIGGER [<trigger_name> | ALL | USER]
    25. ENABLE TRIGGER [<trigger_name> | ALL | USER]
    26. CLUSTER ON <index_name>
    27. SET WITHOUT CLUSTER
    28. SET WITHOUT OIDS
    29. SET (FILLFACTOR = <value>)
    30. RESET (FILLFACTOR)
    31. INHERIT <parent_table>
    32. NO INHERIT <parent_table>
    33. OWNER TO <new_owner>
    34. SET TABLESPACE <new_tablespace>

    See for more information.

    ALTER TABLESPACE

    Changes the definition of a tablespace.

    1. ALTER TABLESPACE <name> RENAME TO <newname>
    2. ALTER TABLESPACE <name> OWNER TO <newowner>

    See for more information.

    ALTER TYPE

    Changes the definition of a data type.

    1. ALTER TYPE <name>
    2. OWNER TO <new_owner> | SET SCHEMA <new_schema>

    See for more information.

    ALTER USER

    Changes the definition of a database role (user).

    1. ALTER USER <name> RENAME TO <newname>
    2. ALTER USER <name> SET <config_parameter> {TO | =} {<value> | DEFAULT}
    3. ALTER USER <name> RESET <config_parameter>
    4. ALTER USER <name> RESOURCE QUEUE {<queue_name> | NONE}
    5. ALTER USER <name> RESOURCE GROUP {<group_name> | NONE}
    6. ALTER USER <name> [ [WITH] <option> [ ... ] ]

    See for more information.

    ALTER VIEW

    Changes the definition of a view.

    1. ALTER VIEW <name> RENAME TO <newname>

    See for more information.

    ANALYZE

    Collects statistics about a database.

    1. ANALYZE [VERBOSE] [<table> [ (<column> [, ...] ) ]]
    2. ANALYZE [VERBOSE] {<root_partition_table_name>|<leaf_partition_table_name>} [ (<column> [, ...] )]
    3. ANALYZE [VERBOSE] ROOTPARTITION {ALL | <root_partition_table_name> [ (<column> [, ...] )]}

    See for more information.

    BEGIN

    Starts a transaction block.

    1. BEGIN [WORK | TRANSACTION] [<transaction_mode>]

    See for more information.

    CHECKPOINT

    Forces a transaction log checkpoint.

    1. CHECKPOINT

    See for more information.

    CLOSE

    Closes a cursor.

    1. CLOSE <cursor_name>

    See for more information.

    CLUSTER

    Physically reorders a heap storage table on disk according to an index. Not a recommended operation in Greenplum Database.

    1. CLUSTER <indexname> ON <tablename>
    2. CLUSTER <tablename>
    3. CLUSTER

    See for more information.

    COMMENT

    Defines or change the comment of an object.

    1. COMMENT ON
    2. { TABLE <object_name> |
    3. COLUMN <table_name.column_name> |
    4. AGGREGATE <agg_name> (<agg_type> [, ...]) |
    5. CAST (<sourcetype> AS <targettype>) |
    6. CONSTRAINT <constraint_name> ON <table_name> |
    7. CONVERSION <object_name> |
    8. DATABASE <object_name> |
    9. DOMAIN <object_name> |
    10. FILESPACE <object_name> |
    11. FUNCTION <func_name> ([[<argmode>] [<argname>] <argtype> [, ...]]) |
    12. INDEX <object_name> |
    13. LARGE OBJECT <large_object_oid> |
    14. OPERATOR <op> (<leftoperand_type>, <rightoperand_type>) |
    15. OPERATOR CLASS <object_name> USING <index_method> |
    16. [PROCEDURAL] LANGUAGE <object_name> |
    17. RESOURCE QUEUE <object_name> |
    18. ROLE <object_name> |
    19. RULE <rule_name> ON <table_name> |
    20. SCHEMA <object_name> |
    21. SEQUENCE <object_name> |
    22. TABLESPACE <object_name> |
    23. TRIGGER <trigger_name> ON <table_name> |
    24. TYPE <object_name> |
    25. VIEW <object_name> }
    26. IS '<text>'

    See for more information.

    COMMIT

    Commits the current transaction.

    1. COMMIT [WORK | TRANSACTION]

    See for more information.

    COPY

    Copies data between a file and a table.

    1. COPY <table> [(<column> [, ...])] FROM {'<file>' | PROGRAM '<command>' | STDIN}
    2. [ [WITH]
    3. [ON SEGMENT]
    4. [BINARY]
    5. [OIDS]
    6. [HEADER]
    7. [DELIMITER [ AS ] '<delimiter>']
    8. [NULL [ AS ] '<null string>']
    9. [ESCAPE [ AS ] '<escape>' | 'OFF']
    10. [NEWLINE [ AS ] 'LF' | 'CR' | 'CRLF']
    11. [CSV [QUOTE [ AS ] '<quote>']
    12. [FORCE NOT NULL <column> [, ...]]
    13. [FILL MISSING FIELDS]
    14. [[LOG ERRORS]
    15. SEGMENT REJECT LIMIT <count> [ROWS | PERCENT] ]
    16. COPY {table [(<column> [, ...])] | (<query>)} TO {'<file>' | PROGRAM '<command>' | STDOUT}
    17. [ [WITH]
    18. [ON SEGMENT]
    19. [BINARY]
    20. [OIDS]
    21. [HEADER]
    22. [DELIMITER [ AS ] 'delimiter']
    23. [NULL [ AS ] 'null string']
    24. [ESCAPE [ AS ] '<escape>' | 'OFF']
    25. [CSV [QUOTE [ AS ] 'quote']
    26. [FORCE QUOTE column [, ...]] ]
    27. [IGNORE EXTERNAL PARTITIONS ]

    See for more information.

    CREATE AGGREGATE

    Defines a new aggregate function.

    1. CREATE [ORDERED] AGGREGATE <name> (<input_data_type> [ , ... ])
    2. ( SFUNC = <sfunc>,
    3. STYPE = <state_data_type>
    4. [, PREFUNC = <prefunc>]
    5. [, FINALFUNC = <ffunc>]
    6. [, INITCOND = <initial_condition>]
    7. [, SORTOP = <sort_operator>] )

    See for more information.

    CREATE CAST

    Defines a new cast.

    1. CREATE CAST (<sourcetype> AS <targettype>)
    2. WITH FUNCTION <funcname> (<argtypes>)
    3. [AS ASSIGNMENT | AS IMPLICIT]
    4. CREATE CAST (<sourcetype> AS <targettype>) WITHOUT FUNCTION
    5. [AS ASSIGNMENT | AS IMPLICIT]

    See for more information.

    CREATE CONVERSION

    Defines a new encoding conversion.

    1. CREATE [DEFAULT] CONVERSION <name> FOR <source_encoding> TO
    2. <dest_encoding> FROM <funcname>

    See for more information.

    CREATE DATABASE

    Creates a new database.

    1. CREATE DATABASE name [ [WITH] [OWNER [=] <dbowner>]
    2. [TEMPLATE [=] <template>]
    3. [ENCODING [=] <encoding>]
    4. [TABLESPACE [=] <tablespace>]
    5. [CONNECTION LIMIT [=] connlimit ] ]

    See for more information.

    CREATE DOMAIN

    Defines a new domain.

    1. CREATE DOMAIN <name> [AS] <data_type> [DEFAULT <expression>]
    2. [CONSTRAINT <constraint_name>
    3. | NOT NULL | NULL
    4. | CHECK (<expression>) [...]]

    See for more information.

    CREATE EXTENSION

    Registers an extension in a Greenplum database.

    1. CREATE EXTENSION [ IF NOT EXISTS ] <extension_name>
    2. [ WITH ] [ SCHEMA <schema_name> ]
    3. [ VERSION <version> ]
    4. [ FROM <old_version> ]
    5. [ CASCADE ]

    See for more information.

    CREATE EXTERNAL TABLE

    Defines a new external table.

    See for more information.

    1. CREATE [OR REPLACE] FUNCTION <name>
    2. ( [ [<argmode>] [<argname>] <argtype> [ { DEFAULT | = } <defexpr> ] [, ...] ] )
    3. [ RETURNS { [ SETOF ] rettype
    4. | TABLE ([{ argname argtype | LIKE other table }
    5. [, ...]])
    6. } ]
    7. { LANGUAGE <langname>
    8. | IMMUTABLE | STABLE | VOLATILE
    9. | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
    10. | NO SQL | CONTAINS SQL | READS SQL DATA | MODIFIES SQL
    11. | [EXTERNAL] SECURITY INVOKER | [EXTERNAL] SECURITY DEFINER
    12. | COST <execution_cost>
    13. | SET <configuration_parameter> { TO <value> | = <value> | FROM CURRENT }
    14. | AS '<definition>'
    15. | AS '<obj_file>', '<link_symbol>' } ...
    16. [ WITH ({ DESCRIBE = describe_function
    17. } [, ...] ) ]

    See for more information.

    CREATE GROUP

    Defines a new database role.

    1. CREATE GROUP <name> [[WITH] <option> [ ... ]]

    See for more information.

    CREATE INDEX

    Defines a new index.

    1. CREATE [UNIQUE] INDEX <name> ON <table>
    2. [USING btree|bitmap|gist]
    3. ( {<column> | (<expression>)} [<opclass>] [, ...] )
    4. [ WITH ( FILLFACTOR = <value> ) ]
    5. [TABLESPACE <tablespace>]
    6. [WHERE <predicate>]

    See for more information.

    CREATE LANGUAGE

    Defines a new procedural language.

    1. CREATE [PROCEDURAL] LANGUAGE <name>
    2. CREATE [TRUSTED] [PROCEDURAL] LANGUAGE <name>
    3. HANDLER <call_handler> [ INLINE <inline_handler> ] [VALIDATOR <valfunction>]

    See for more information.

    CREATE OPERATOR

    Defines a new operator.

    1. CREATE OPERATOR <name> (
    2. PROCEDURE = <funcname>
    3. [, LEFTARG = <lefttype>] [, RIGHTARG = <righttype>]
    4. [, COMMUTATOR = <com_op>] [, NEGATOR = <neg_op>]
    5. [, RESTRICT = <res_proc>] [, JOIN = <join_proc>]
    6. [, HASHES] [, MERGES] )

    See for more information.

    CREATE OPERATOR CLASS

    Defines a new operator class.

    1. CREATE OPERATOR CLASS <name> [DEFAULT] FOR TYPE <data_type>
    2. USING <index_method> AS
    3. {
    4. OPERATOR <strategy_number> <op_name> [(<op_type>, <op_type>)] [RECHECK]
    5. | FUNCTION <support_number> <funcname> (<argument_type> [, ...] )
    6. | STORAGE <storage_type>
    7. } [, ... ]

    See for more information.

    CREATE OPERATOR FAMILY

    Defines a new operator family.

    1. CREATE OPERATOR FAMILY <name> USING <index_method>

    See for more information.

    CREATE PROTOCOL

    Registers a custom data access protocol that can be specified when defining a Greenplum Database external table.

    1. CREATE [TRUSTED] PROTOCOL <name> (
    2. [readfunc='<read_call_handler>'] [, writefunc='<write_call_handler>']
    3. [, validatorfunc='<validate_handler>' ])

    See for more information.

    CREATE RESOURCE GROUP

    Defines a new resource group.

    1. CREATE RESOURCE GROUP <name> WITH (<group_attribute>=<value> [, ... ])

    See for more information.

    CREATE RESOURCE QUEUE

    Defines a new resource queue.

    1. CREATE RESOURCE QUEUE <name> WITH (<queue_attribute>=<value> [, ... ])

    See for more information.

    CREATE ROLE

    Defines a new database role (user or group).

    1. CREATE ROLE <name> [[WITH] <option> [ ... ]]

    See for more information.

    CREATE RULE

    Defines a new rewrite rule.

    1. CREATE [OR REPLACE] RULE <name> AS ON <event>
    2. TO <table> [WHERE <condition>]
    3. DO [ALSO | INSTEAD] { NOTHING | <command> | (<command>; <command>
    4. ...) }

    See for more information.

    CREATE SCHEMA

    Defines a new schema.

    1. CREATE SCHEMA <schema_name> [AUTHORIZATION <username>]
    2. [<schema_element> [ ... ]]
    3. CREATE SCHEMA AUTHORIZATION <rolename> [<schema_element> [ ... ]]

    See for more information.

    CREATE SEQUENCE

    Defines a new sequence generator.

    1. CREATE [TEMPORARY | TEMP] SEQUENCE <name>
    2. [INCREMENT [BY] <value>]
    3. [MINVALUE <minvalue> | NO MINVALUE]
    4. [MAXVALUE <maxvalue> | NO MAXVALUE]
    5. [START [ WITH ] <start>]
    6. [CACHE <cache>]
    7. [[NO] CYCLE]
    8. [OWNED BY { <table>.<column> | NONE }]

    See for more information.

    CREATE TABLE

    Defines a new table.

    1. CREATE [[GLOBAL | LOCAL] {TEMPORARY | TEMP}] TABLE <table_name> (
    2. [ { <column_name> <data_type> [ DEFAULT <default_expr> ]
    3. [<column_constraint> [ ... ]
    4. [ ENCODING ( <storage_directive> [,...] ) ]
    5. ]
    6. | <table_constraint>
    7. | LIKE <other_table> [{INCLUDING | EXCLUDING}
    8. {DEFAULTS | CONSTRAINTS}] ...}
    9. [, ... ] ]
    10. )
    11. [ INHERITS ( <parent_table> [, ... ] ) ]
    12. [ WITH ( <storage_parameter>=<value> [, ... ] )
    13. [ ON COMMIT {PRESERVE ROWS | DELETE ROWS | DROP} ]
    14. [ DISTRIBUTED BY (<column>, [ ... ] ) | DISTRIBUTED RANDOMLY ]
    15. [ PARTITION BY <partition_type> (<column>)
    16. [ SUBPARTITION BY <partition_type> (<column>) ]
    17. [ SUBPARTITION TEMPLATE ( <template_spec >) ]
    18. [...]
    19. ( <partition_spec> )
    20. | [ SUBPARTITION BY <partition_type> (<column>) ]
    21. [...]
    22. ( <partition_spec>
    23. [ ( <subpartition_spec>
    24. [(...)]
    25. ) ]
    26. )

    See for more information.

    CREATE TABLE AS

    Defines a new table from the results of a query.

    1. CREATE [ [GLOBAL | LOCAL] {TEMPORARY | TEMP} ] TABLE <table_name>
    2. [(<column_name> [, ...] )]
    3. [ WITH ( <storage_parameter>=<value> [, ... ] ) ]
    4. [ON COMMIT {PRESERVE ROWS | DELETE ROWS | DROP}]
    5. [TABLESPACE <tablespace>]
    6. AS <query>
    7. [DISTRIBUTED BY (<column>, [ ... ] ) | DISTRIBUTED RANDOMLY]

    See for more information.

    CREATE TABLESPACE

    Defines a new tablespace.

    1. CREATE TABLESPACE <tablespace_name> [OWNER <username>]
    2. FILESPACE <filespace_name>

    See for more information.

    CREATE TYPE

    Defines a new data type.

    1. CREATE TYPE <name> AS ( <attribute_name> <data_type> [, ... ] )
    2. CREATE TYPE <name> AS ENUM ( '<label>' [, ... ] )
    3. CREATE TYPE <name> (
    4. INPUT = <input_function>,
    5. OUTPUT = <output_function>
    6. [, RECEIVE = <receive_function>]
    7. [, SEND = <send_function>]
    8. [, TYPMOD_IN = <type_modifier_input_function> ]
    9. [, TYPMOD_OUT = <type_modifier_output_function> ]
    10. [, INTERNALLENGTH = {<internallength> | VARIABLE}]
    11. [, PASSEDBYVALUE]
    12. [, ALIGNMENT = <alignment>]
    13. [, STORAGE = <storage>]
    14. [, DEFAULT = <default>]
    15. [, ELEMENT = <element>]
    16. [, DELIMITER = <delimiter>] )
    17. CREATE TYPE <name>

    See for more information.

    CREATE USER

    Defines a new database role with the LOGIN privilege by default.

    1. CREATE USER <name> [[WITH] <option> [ ... ]]

    See for more information.

    CREATE VIEW

    Defines a new view.

    1. CREATE [OR REPLACE] [TEMP | TEMPORARY] VIEW <name>
    2. [ ( <column_name> [, ...] ) ]
    3. AS <query>

    See for more information.

    DEALLOCATE

    Deallocates a prepared statement.

    1. DEALLOCATE [PREPARE] <name>

    See for more information.

    DECLARE

    Defines a cursor.

    1. DECLARE <name> [BINARY] [INSENSITIVE] [NO SCROLL] CURSOR
    2. [{WITH | WITHOUT} HOLD]
    3. FOR <query> [FOR READ ONLY]

    See for more information.

    DELETE

    Deletes rows from a table.

    1. DELETE FROM [ONLY] <table> [[AS] <alias>]
    2. [USING <usinglist>]
    3. [WHERE <condition> | WHERE CURRENT OF <cursor_name> ]

    See for more information.

    DISCARD

    Discards the session state.

    1. DISCARD { ALL | PLANS | TEMPORARY | TEMP }

    See for more information.

    DROP AGGREGATE

    Removes an aggregate function.

    1. DROP AGGREGATE [IF EXISTS] <name> ( <type> [, ...] ) [CASCADE | RESTRICT]

    See for more information.

    DO

    Executes an anonymous code block as a transient anonymous function.

    1. DO [ LANGUAGE <lang_name> ] <code>

    See for more information.

    DROP CAST

    Removes a cast.

    1. DROP CAST [IF EXISTS] (<sourcetype> AS <targettype>) [CASCADE | RESTRICT]

    See for more information.

    DROP CONVERSION

    Removes a conversion.

    1. DROP CONVERSION [IF EXISTS] <name> [CASCADE | RESTRICT]

    See for more information.

    DROP DATABASE

    Removes a database.

    1. DROP DATABASE [IF EXISTS] <name>

    See for more information.

    DROP DOMAIN

    Removes a domain.

    1. DROP DOMAIN [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See for more information.

    DROP EXTENSION

    Removes an extension from a Greenplum database.

    1. DROP EXTENSION [ IF EXISTS ] <name> [, ...] [ CASCADE | RESTRICT ]

    See for more information.

    DROP EXTERNAL TABLE

    Removes an external table definition.

    1. DROP EXTERNAL [WEB] TABLE [IF EXISTS] <name> [CASCADE | RESTRICT]

    See for more information.

    DROP FILESPACE

    Removes a filespace.

    1. DROP FILESPACE [IF EXISTS] <filespacename>

    See for more information.

    DROP FUNCTION

    Removes a function.

    1. DROP FUNCTION [IF EXISTS] name ( [ [argmode] [argname] argtype
    2. [, ...] ] ) [CASCADE | RESTRICT]

    See for more information.

    DROP GROUP

    Removes a database role.

    1. DROP GROUP [IF EXISTS] <name> [, ...]

    See for more information.

    DROP INDEX

    Removes an index.

    1. DROP INDEX [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See for more information.

    DROP LANGUAGE

    Removes a procedural language.

    1. DROP [PROCEDURAL] LANGUAGE [IF EXISTS] <name> [CASCADE | RESTRICT]

    See for more information.

    DROP OPERATOR

    Removes an operator.

    1. DROP OPERATOR [IF EXISTS] <name> ( {<lefttype> | NONE} ,
    2. {<righttype> | NONE} ) [CASCADE | RESTRICT]

    See for more information.

    DROP OPERATOR CLASS

    Removes an operator class.

    1. DROP OPERATOR CLASS [IF EXISTS] <name> USING <index_method> [CASCADE | RESTRICT]

    See for more information.

    DROP OPERATOR FAMILY

    Removes an operator family.

    1. DROP OPERATOR FAMILY [IF EXISTS] <name> USING <index_method> [CASCADE | RESTRICT]

    See for more information.

    DROP OWNED

    Removes database objects owned by a database role.

    See for more information.

    Removes a external table data access protocol from a database.

    1. DROP PROTOCOL [IF EXISTS] <name>

    DROP RESOURCE GROUP

    Removes a resource group.

    1. DROP RESOURCE GROUP <group_name>

    See DROP RESOURCE GROUP for more information.

    DROP RESOURCE QUEUE

    Removes a resource queue.

    1. DROP RESOURCE QUEUE <queue_name>

    See DROP RESOURCE QUEUE for more information.

    DROP ROLE

    Removes a database role.

    1. DROP ROLE [IF EXISTS] <name> [, ...]

    See DROP ROLE for more information.

    DROP RULE

    Removes a rewrite rule.

    1. DROP RULE [IF EXISTS] <name> ON <relation> [CASCADE | RESTRICT]

    See DROP RULE for more information.

    DROP SCHEMA

    Removes a schema.

    1. DROP SCHEMA [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See DROP SCHEMA for more information.

    DROP SEQUENCE

    Removes a sequence.

    1. DROP SEQUENCE [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See DROP SEQUENCE for more information.

    DROP TABLE

    Removes a table.

    1. DROP TABLE [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See DROP TABLE for more information.

    DROP TABLESPACE

    Removes a tablespace.

    1. DROP TABLESPACE [IF EXISTS] <tablespacename>

    See DROP TABLESPACE for more information.

    DROP TYPE

    Removes a data type.

    1. DROP TYPE [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See DROP TYPE for more information.

    DROP USER

    Removes a database role.

    1. DROP USER [IF EXISTS] <name> [, ...]

    See DROP USER for more information.

    DROP VIEW

    Removes a view.

    1. DROP VIEW [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]

    See DROP VIEW for more information.

    END

    Commits the current transaction.

    1. END [WORK | TRANSACTION]

    See END for more information.

    EXECUTE

    Executes a prepared SQL statement.

    1. EXECUTE <name> [ (<parameter> [, ...] ) ]

    See EXECUTE for more information.

    EXPLAIN

    Shows the query plan of a statement.

    1. EXPLAIN [ANALYZE] [VERBOSE] <statement>

    See EXPLAIN for more information.

    FETCH

    Retrieves rows from a query using a cursor.

    1. FETCH [ <forward_direction> { FROM | IN } ] <cursorname>

    See FETCH for more information.

    GRANT

    Defines access privileges.

    1. GRANT { {SELECT | INSERT | UPDATE | DELETE | REFERENCES |
    2. TRIGGER | TRUNCATE } [,...] | ALL [PRIVILEGES] }
    3. ON [TABLE] <tablename> [, ...]
    4. TO {<rolename> | PUBLIC} [, ...] [WITH GRANT OPTION]
    5. GRANT { {USAGE | SELECT | UPDATE} [,...] | ALL [PRIVILEGES] }
    6. ON SEQUENCE <sequencename> [, ...]
    7. TO { <rolename> | PUBLIC } [, ...] [WITH GRANT OPTION]
    8. GRANT { {CREATE | CONNECT | TEMPORARY | TEMP} [,...] | ALL
    9. [PRIVILEGES] }
    10. ON DATABASE <dbname> [, ...]
    11. TO {<rolename> | PUBLIC} [, ...] [WITH GRANT OPTION]
    12. GRANT { USAGE | ALL [ PRIVILEGES ] }
    13. ON FOREIGN DATA WRAPPER <fdwname> [, ...]
    14. TO { [ GROUP ] <rolename> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
    15. GRANT { USAGE | ALL [ PRIVILEGES ] }
    16. ON FOREIGN SERVER <servername> [, ...]
    17. TO { [ GROUP ] <rolename> | PUBLIC } [, ...] [ WITH GRANT OPTION ]
    18. GRANT { EXECUTE | ALL [PRIVILEGES] }
    19. ON FUNCTION <funcname> ( [ [<argmode>] [<argname>] <argtype> [, ...]
    20. ] ) [, ...]
    21. TO {<rolename> | PUBLIC} [, ...] [WITH GRANT OPTION]
    22. GRANT { USAGE | ALL [PRIVILEGES] }
    23. ON LANGUAGE <langname> [, ...]
    24. TO {<rolename> | PUBLIC} [, ...] [WITH GRANT OPTION]
    25. GRANT { {CREATE | USAGE} [,...] | ALL [PRIVILEGES] }
    26. ON SCHEMA <schemaname> [, ...]
    27. TO {<rolename> | PUBLIC} [, ...] [WITH GRANT OPTION]
    28. GRANT { CREATE | ALL [PRIVILEGES] }
    29. ON TABLESPACE <tablespacename> [, ...]
    30. TO {<rolename> | PUBLIC} [, ...] [WITH GRANT OPTION]
    31. GRANT <parent_role> [, ...]
    32. TO <member_role> [, ...] [WITH ADMIN OPTION]
    33. GRANT { SELECT | INSERT | ALL [PRIVILEGES] }
    34. ON PROTOCOL <protocolname>
    35. TO <username>

    See GRANT for more information.

    INSERT

    Creates new rows in a table.

    1. INSERT INTO <table> [( <column> [, ...] )]
    2. {DEFAULT VALUES | VALUES ( {<expression> | DEFAULT} [, ...] )
    3. [, ...] | <query>}

    See INSERT for more information.

    LOAD

    Loads or reloads a shared library file.

    1. LOAD '<filename>'

    See LOAD for more information.

    LOCK

    Locks a table.

    1. LOCK [TABLE] name [, ...] [IN <lockmode> MODE] [NOWAIT]

    See LOCK for more information.

    MOVE

    Positions a cursor.

    1. MOVE [ <forward_direction> {FROM | IN} ] <cursorname>

    See MOVE for more information.

    PREPARE

    Prepare a statement for execution.

    1. PREPARE <name> [ (<datatype> [, ...] ) ] AS <statement>

    See PREPARE for more information.

    REASSIGN OWNED

    Changes the ownership of database objects owned by a database role.

    1. REASSIGN OWNED BY <old_role> [, ...] TO <new_role>

    See REASSIGN OWNED for more information.

    REINDEX

    Rebuilds indexes.

    1. REINDEX {INDEX | TABLE | DATABASE | SYSTEM} <name>

    See REINDEX for more information.

    RELEASE SAVEPOINT

    Destroys a previously defined savepoint.

    1. RELEASE [SAVEPOINT] <savepoint_name>

    See RELEASE SAVEPOINT for more information.

    RESET

    Restores the value of a system configuration parameter to the default value.

    1. RESET <configuration_parameter>
    2. RESET ALL

    See RESET for more information.

    REVOKE

    Removes access privileges.

    1. REVOKE [GRANT OPTION FOR] { {SELECT | INSERT | UPDATE | DELETE
    2. | REFERENCES | TRIGGER | TRUNCATE } [,...] | ALL [PRIVILEGES] }
    3. ON [TABLE] <tablename> [, ...]
    4. FROM {<rolename> | PUBLIC} [, ...]
    5. [CASCADE | RESTRICT]
    6. REVOKE [GRANT OPTION FOR] { {USAGE | SELECT | UPDATE} [,...]
    7. | ALL [PRIVILEGES] }
    8. ON SEQUENCE <sequencename> [, ...]
    9. FROM { <rolename> | PUBLIC } [, ...]
    10. [CASCADE | RESTRICT]
    11. REVOKE [GRANT OPTION FOR] { {CREATE | CONNECT
    12. | TEMPORARY | TEMP} [,...] | ALL [PRIVILEGES] }
    13. ON DATABASE <dbname> [, ...]
    14. FROM {rolename | PUBLIC} [, ...]
    15. [CASCADE | RESTRICT]
    16. REVOKE [GRANT OPTION FOR] {EXECUTE | ALL [PRIVILEGES]}
    17. ON FUNCTION <funcname> ( [[<argmode>] [<argname>] <argtype>
    18. [, ...]] ) [, ...]
    19. FROM {<rolename> | PUBLIC} [, ...]
    20. [CASCADE | RESTRICT]
    21. REVOKE [GRANT OPTION FOR] {USAGE | ALL [PRIVILEGES]}
    22. ON LANGUAGE <langname> [, ...]
    23. FROM {<rolename> | PUBLIC} [, ...]
    24. [ CASCADE | RESTRICT ]
    25. REVOKE [GRANT OPTION FOR] { {CREATE | USAGE} [,...]
    26. | ALL [PRIVILEGES] }
    27. ON SCHEMA <schemaname> [, ...]
    28. FROM {<rolename> | PUBLIC} [, ...]
    29. [CASCADE | RESTRICT]
    30. REVOKE [GRANT OPTION FOR] { CREATE | ALL [PRIVILEGES] }
    31. ON TABLESPACE <tablespacename> [, ...]
    32. FROM { <rolename> | PUBLIC } [, ...]
    33. [CASCADE | RESTRICT]
    34. REVOKE [ADMIN OPTION FOR] <parent_role> [, ...]
    35. FROM <member_role> [, ...]
    36. [CASCADE | RESTRICT]

    See REVOKE for more information.

    ROLLBACK

    Aborts the current transaction.

    1. ROLLBACK [WORK | TRANSACTION]

    See ROLLBACK for more information.

    ROLLBACK TO SAVEPOINT

    Rolls back the current transaction to a savepoint.

    1. ROLLBACK [WORK | TRANSACTION] TO [SAVEPOINT] <savepoint_name>

    See ROLLBACK TO SAVEPOINT for more information.

    SAVEPOINT

    Defines a new savepoint within the current transaction.

    1. SAVEPOINT <savepoint_name>

    See SAVEPOINT for more information.

    SELECT

    Retrieves rows from a table or view.

    1. [ WITH [ RECURSIVE1 ] <with_query> [, ...] ]
    2. SELECT [ALL | DISTINCT [ON (<expression> [, ...])]]
    3. * | <expression >[[AS] <output_name>] [, ...]
    4. [FROM <from_item> [, ...]]
    5. [WHERE <condition>]
    6. [GROUP BY <grouping_element> [, ...]]
    7. [HAVING <condition> [, ...]]
    8. [WINDOW <window_name> AS (<window_specification>)]
    9. [{UNION | INTERSECT | EXCEPT} [ALL] <select>]
    10. [ORDER BY <expression> [ASC | DESC | USING <operator>] [NULLS {FIRST | LAST}] [, ...]]
    11. [LIMIT {<count> | ALL}]
    12. [OFFSET <start>]
    13. [FOR {UPDATE | SHARE} [OF <table_name> [, ...]] [NOWAIT] [...]]

    See SELECT for more information.

    SELECT INTO

    Defines a new table from the results of a query.

    1. [ WITH [ RECURSIVE1 ] <with_query> [, ...] ]
    2. SELECT [ALL | DISTINCT [ON ( <expression> [, ...] )]]
    3. * | <expression> [AS <output_name>] [, ...]
    4. INTO [TEMPORARY | TEMP] [TABLE] <new_table>
    5. [FROM <from_item> [, ...]]
    6. [WHERE <condition>]
    7. [GROUP BY <expression> [, ...]]
    8. [HAVING <condition> [, ...]]
    9. [{UNION | INTERSECT | EXCEPT} [ALL] <select>]
    10. [ORDER BY <expression> [ASC | DESC | USING <operator>] [NULLS {FIRST | LAST}] [, ...]]
    11. [LIMIT {<count> | ALL}]
    12. [OFFSET <start>]
    13. [FOR {UPDATE | SHARE} [OF <table_name> [, ...]] [NOWAIT]
    14. [...]]

    See SELECT INTO for more information.

    SET

    Changes the value of a Greenplum Database configuration parameter.

    1. SET [SESSION | LOCAL] <configuration_parameter> {TO | =} <value> |
    2. '<value>' | DEFAULT}
    3. SET [SESSION | LOCAL] TIME ZONE {<timezone> | LOCAL | DEFAULT}

    See SET for more information.

    SET ROLE

    Sets the current role identifier of the current session.

    1. SET [SESSION | LOCAL] ROLE <rolename>
    2. SET [SESSION | LOCAL] ROLE NONE
    3. RESET ROLE

    See SET ROLE for more information.

    SET SESSION AUTHORIZATION

    Sets the session role identifier and the current role identifier of the current session.

    1. SET [SESSION | LOCAL] SESSION AUTHORIZATION <rolename>
    2. SET [SESSION | LOCAL] SESSION AUTHORIZATION DEFAULT
    3. RESET SESSION AUTHORIZATION

    See SET SESSION AUTHORIZATION for more information.

    SET TRANSACTION

    Sets the characteristics of the current transaction.

    1. SET TRANSACTION [<transaction_mode>] [READ ONLY | READ WRITE]
    2. SET SESSION CHARACTERISTICS AS TRANSACTION <transaction_mode>
    3. [READ ONLY | READ WRITE]

    See SET TRANSACTION for more information.

    SHOW

    Shows the value of a system configuration parameter.

    1. SHOW <configuration_parameter>
    2. SHOW ALL

    See SHOW for more information.

    START TRANSACTION

    Starts a transaction block.

    1. START TRANSACTION [SERIALIZABLE | READ COMMITTED | READ UNCOMMITTED]
    2. [READ WRITE | READ ONLY]

    See START TRANSACTION for more information.

    TRUNCATE

    Empties a table of all rows.

    1. TRUNCATE [TABLE] <name> [, ...] [CASCADE | RESTRICT]

    See TRUNCATE for more information.

    UPDATE

    Updates rows of a table.

    1. UPDATE [ONLY] <table> [[AS] <alias>]
    2. SET {<column> = {<expression> | DEFAULT} |
    3. (<column> [, ...]) = ({<expression> | DEFAULT} [, ...])} [, ...]
    4. [FROM <fromlist>]
    5. [WHERE <condition >| WHERE CURRENT OF <cursor_name> ]

    See UPDATE for more information.

    VACUUM

    Garbage-collects and optionally analyzes a database.

    See VACUUM for more information.

    Computes a set of rows.

    1. VALUES ( <expression> [, ...] ) [, ...]
    2. [LIMIT {<count> | ALL}] [OFFSET <start>]

    See VALUES for more information.