DDL Syntax Overview
Data definition language (DDL) is used to define or modify an object in a database, such as a table, an index, or a view.
GaussDB does not support DDL operations when the CN is incomplete. For example, if a CN in cluster is faulty, creating a database or a table will fail.
Defining a Role
A role is used to manage permissions. For database security, management and operation permissions can be granted to different roles. For details about related SQL statements, see Table 1.
Defining a User
A user is used to log in to a database. Different permissions can be granted to users for managing data accesses and operations of the users. For details about related SQL statements, see Table 2.
Defining a CMK
Client master keys (CMKs) are used to encrypt column encryption keys (CEKs) for the encrypted database feature. CMK definition includes creating and deleting a CMK. For details about related SQL statements, see Table 3.
Defining a CEK
CEKs are used to encrypt data for the encrypted database feature. You can create a CEK, change the client master key specified by a CEK, and delete a CEK. For details about related SQL statements, see Table 3.
Function |
SQL Statement |
---|---|
Creating a CEK |
|
Changing the client master key specified by a CEK |
|
Deleting a CEK |
Defining a Database
A database is the warehouse for organizing, storing, and managing data. Defining a database includes: creating a database, altering the database attributes, and dropping the database. For details about related SQL statements, see Table 5.
Defining a Schema
A schema is the set of a group of database objects and is used to control the access to the database objects. For details about related SQL statements, see Table 6.
Defining a Tablespace
A tablespace is used to manage data objects and corresponds to a catalog on a disk. For details about related SQL statements, see Table 7.
Defining a Table
A table is a special data structure in a database and is used to store data objects and relationship between data objects. For details about related SQL statements, see Table 8.
Defining a Partitioned Table
A partitioned table is a logical table used to improve query performance and does not store data (data is stored in ordinary tables). For details about related SQL statements, see Table 9.
Defining an Index
An index indicates the sequence of values in one or more columns in a database table. It is a data structure that improves the speed of data access to specific information in a database table. For details about related SQL statements, see Table 10.
Defining a Stored Procedure
A stored procedure is a set of SQL statements for achieving specific functions and is stored in the database after compiling. Users can specify a name and provide parameters (if necessary) to execute the stored procedure. For details about related SQL statements, see Table 11.
Defining a Function
In GaussDB, a function is similar to a stored procedure, which is a set of SQL statements. The function and stored procedure are used the same. For details about related SQL statements, see Table 12.
Defining a Cursor
To process SQL statements, the stored procedure thread assigns a memory segment to store context association. Cursors are handles or pointers to context regions. With a cursor, the stored procedure can control alterations in context areas. For details, see Table 13.
Defining a Resource Pool
A resource pool is a system catalog used by the resource load management module to specify attributes related to resource management, such as Cgroups. For details about related SQL statements, see Table 14.
Defining an Aggregate Function
Function |
SQL Statement |
---|---|
Creating an aggregate function |
|
Modifying an aggregate function |
|
Deleting an aggregate function |
Defining a Plug-in Extension
Function |
SQL Statement |
---|---|
Creating an extension |
The extended function is for internal use only. You are advised not to use it.
Defining a Data Type
Function |
SQL Statement |
---|---|
Creating a data type |
|
Modifying a data type |
|
Deleting a data type |
Defining a Database Link
A database link can be used to remotely operate a database object. For details about corresponding SQL statements, see Table 18.
Defining an Audit Policy
Function |
SQL Statement |
---|---|
Creating a unified audit policy |
|
Modifying a unified audit policy |
|
Deleting an audit policy |
Setting the nodeis_active Column of a Specified Node
ALTER COORDINATOR describes how to change the value of the nodeis_active column of a specified node in the pgxc_node system catalog.
Defining a Directory
Function |
SQL Statement |
---|---|
Creating a directory |
|
Modifying attributes of a directory |
|
Deleting a specified directory |
Defining a Foreign Data Wrapper
Function |
SQL Statement |
---|---|
Creating a foreign data wrapper |
|
Modifying a foreign data wrapper |
|
Deleting a foreign data wrapper |
SQL Statements Related to the gs_global_config System Catalog
Function |
SQL Statement |
---|---|
Adding and modifying parameter values in the gs_global_config system catalog |
|
Deleting parameter values from the gs_global_config system catalog |
|
Inserting one or more weak passwords into the gs_global_config system catalog |
|
Clearing all weak passwords in the gs_global_config system catalog |
Defining a User Group
Function |
SQL Statement |
---|---|
Creating a user group |
|
Modifying attributes of a user group |
|
Deleting a user group |
Defining a Procedural Language
Function |
SQL Statement |
---|---|
Defining a new procedural language |
|
Modifying the definition of a procedural language |
|
Deleting a procedural language |
Defining a Masking Policy
Function |
SQL Statement |
---|---|
Creating a masking policy |
|
Modifying a masking policy |
|
Deleting a masking policy |
Defining a Materialized View
Function |
SQL Statement |
---|---|
Creating a complete-refresh materialized view |
|
Creating a fast-refresh materialized view |
|
Modifying multiple auxiliary attributes of an existing materialized view |
|
Forcibly deleting an existing materialized view from the database |
|
Refreshing a materialized view in complete refresh mode |
|
Refreshing a materialized view in fast refresh mode |
Defining a Node
Function |
SQL Statement |
---|---|
Creating a cluster node |
|
Modifying the definition of an existing node |
|
Deleting a node |
Defining a Node Group
Function |
SQL Statement |
---|---|
Creating a cluster node group |
|
Modifying information about an existing node group |
|
Deleting a node group |
Defining a Resource Label
Function |
SQL Statement |
---|---|
Creating a resource label |
|
Modifying a resource label |
|
Deleting a resource label |
Defining a Row-Level Security Policy
Function |
SQL Statement |
---|---|
Creating a row-level security policy for a table |
|
Modifying an existing row-level security policy |
|
Deleting a row-level security policy from a table |
Defining a Sequence
Function |
SQL Statement |
---|---|
Adding a sequence to the current database |
|
Modifying parameters of an existing sequence |
|
Deleting a sequence from the current database |
Defining a Foreign Server
Function |
SQL Statement |
---|---|
Defining a new foreign server |
|
Adding, modifying, and deleting parameters of an existing server |
|
Deleting a data server |
Defining a Synonym Object
Function |
SQL Statement |
---|---|
Creating a synonym object |
|
Modifying the owner of a synonym object |
|
Deleting a specified synonym object |
Defining a Trigger
Function |
SQL Statement |
---|---|
Creating a trigger |
|
Renaming a trigger |
|
Deleting a trigger |
Defining a View
Function |
SQL Statement |
---|---|
Creating a view |
|
Modifying the auxiliary attributes of a view |
|
Forcibly deleting a view from the database |
Collecting Statistics
For details about how to collect statistics related to the contents of ordinary tables in the database, see ANALYZE | ANALYSE.
Creating a Synchronization Point
For details about how to create a synchronization point between nodes in a new cluster, see CREATE BARRIER.
Creating an Encoding Conversion Task
For details about how to define a new conversion between two character set encodings, see CREATE CONVERSION.
Defining a Model
Function |
SQL Statement |
---|---|
Training a machine learning model and saving the model |
|
Deleting a model that has been trained and saved |
Defining a Security Label
Function |
SQL Statement |
---|---|
Creating a security label |
|
Applying, updating, or canceling a security label |
|
Deleting a security label |
Importing a Database/Table
Function |
SQL Statement |
---|---|
Preparation phase for importing a database |
|
Execution phase of importing a database |
|
Preparation phase for importing a table |
|
Execution phase of importing a table |
Clearing a Recycle Bin
GaussDB provides statements for clearing a recycle bin. For details, see PURGE.
Clustering a Table
GaussDB supports statements for clustering a table based on an index. For details, see CLUSTER.
Defining an Object Comment
GaussDB supports statements for defining or modifying an object comment. For details, see COMMENT.
Creating a Table Based on Query Results
GaussDB supports statements for creating a table based on query results and inserting queried data into the new table. For details, see SELECT INTO.
Restoring a Table to an Earlier State
GaussDB allows you to restore a table to an earlier state in the event of a manual operation or application error. For details, see TIMECAPSULE TABLE.
Clearing Table Data
GaussDB supports statements for quickly deleting all rows from a table. For details, see TRUNCATE.
Recycling Storage Space
GaussDB supports statements for recycling storage space occupied by deleted rows in a table or B-Tree index. For details, see VACUUM.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot