Updated on 2024-05-07 GMT+08:00

DML Syntax Overview

Data manipulation language (DML) is used to perform operations on data in database tables, such as inserting, updating, querying, or deleting data.

Inserting Data

Inserting data refers to adding one or multiple records to a database table. For details, see INSERT.

Updating Data

Updating data refers to modifying one or multiple records in a database table. For details, see UPDATE.

Querying Data

The database query statement SELECT is used to search required information in a database. For details, see SELECT.

Deleting Data

GaussDB provides two statements for deleting data from database tables. To delete data meeting specified conditions from a database table, see DELETE. To delete all data from a database table, see TRUNCATE.

TRUNCATE can quickly delete all data from a database table, which achieves the effect same as that running DELETE to delete data without specifying conditions from each table. Deletion efficiency using TRUNCATE is faster because TRUNCATE does not scan tables. Therefore, TRUNCATE is useful in large tables.

Copying Data

GaussDB provides a statement for copying data between tables and files. For details, see COPY.

Locking a Table

GaussDB provides multiple lock modes to control concurrent accesses to table data. For details, see LOCK.

Calling a Function

GaussDB provides three statements for calling functions. These statements are the same in the syntax structure. For details, see CALL.

Session Management

A session is a connection established between the user and the database. Table 1 lists the related SQL statements.

Table 1 SQL statements related to sessions

Function

SQL Statement

Altering a session

ALTER SESSION

Killing a session

ALTER SYSTEM KILL SESSION