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 if its CN is unavailable. For example, if the primary node of the database is faulty, creating a database or a table will fail.
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 1.
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 1.
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 3.
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 4.
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 5.
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 6.
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 7.
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 8.
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 9.
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 10.
Defining a Package
A package consists of the package specification and package body. It is used to manage stored procedures and functions by class, which is similar to classes in languages such as Java and C++.
Function |
SQL Statement |
---|---|
Creating a package |
|
Deleting a package |
|
Altering a package attribute |
Defining a View
A view is a virtual table exported from one or more basic tables. It is used to control data accesses of users. Table 12 lists the related SQL statements.
Defining a Cursor
To process SQL statements, the stored procedure process 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 an Aggregate Function
Function |
SQL Statement |
---|---|
Creating an aggregate function |
|
Modifying an aggregate function |
|
Deleting an aggregate function |
Defining Data Type Conversion
Function |
SQL Statement |
---|---|
Creating user-defined data type conversion |
|
Deleting user-defined data type conversion |
Defining a Plug-in Extension
The extended function is for internal use only. You are advised not to use it.
Function |
SQL Statement |
---|---|
Creating a plug-in extension |
|
Modifying a plug-in extension |
|
Deleting a plug-in extension |
Defining an Operator
Function |
SQL Statement |
---|---|
Creating an operator |
|
Modifying an operator |
|
Deleting an operator |
Defining a Data Type
Function |
SQL Statement |
---|---|
Creating a data type |
|
Modifying a data type |
|
Deleting a data type |
Defining a Scheduled Task
Function |
SQL Statement |
---|---|
Creating a scheduled task |
|
Modifying a scheduled task |
|
Deleting a scheduled task |
Defining a Database Link
A database link can be used to remotely operate a database object. For details about corresponding SQL statements, see Table 20.
Defining a Foreign Data Wrapper
Function |
SQL Statement |
---|---|
Creating a foreign data wrapper |
|
Modifying a foreign data wrapper |
|
Deleting a foreign data wrapper |
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