Skip to main content
DML statements let you add, remove, and manage the data stored in tables. You can write and execute DML statements like any other SQL statements in the System. The SELECT SQL statement is sometimes considered a DML statement, and the Ocient System includes it in the Data Query Language (DQL). For details, see the Data Query Language (DQL) Statement Reference. Supported DML SQL statements are:
  • DELETE FROM TABLE
  • INSERT INTO TABLE
  • TRUNCATE TABLE

DELETE FROM TABLE

Removes rows from the specified table. You can use the WHERE clause to specify the rows to remove. If a DELETE SQL statement lacks the WHERE clause, then the database deletes all rows in the table. To use this statement, you must have the DELETE privilege for the table. For details and examples, see Remove Records from an Ocient System.
DELETE actions cannot be undone.If a DELETE operation fails during execution, the database rolls back the changes and returns to its original state.
Due to limitations of the JDBC API, the reported modified row count might not be accurate for DELETE operations that are larger than two billion rows.
Syntax
SQL
Examples Delete Rows from the Table with Filter Criteria This DELETE SQL statement removes all rows in the movies table that have a budget of less than 10000.
SQL
Delete Rows from the Table Using a Common Table Expression This example uses a common table expression using the WITH keyword to find rows representing all transactions that occurred before 2022 that are less than $100. The DELETE SQL statement receives the results from the common table expression. Then, the database executes this statement to delete the corresponding rows.
SQL

INSERT INTO TABLE

INSERT INTO inserts rows into a table in the current database using literal values, column references, function executions, computed expressions, or column default values. This SQL statement requires the INSERT privilege for the relevant table.
Due to limitations of the JDBC API, the reported modified row count might not be accurate for insert operations that are larger than two billion rows.
Syntax
SQL
Using DEFAULT VALUES inserts a single row where each target column is populated with its column defaults (as defined in the column definition) instead of an explicit VALUES list.For table columns that do not each have a defined default value, the inserted row is NULL. If the column has no default and also has the NOT NULL constraint, the insert operation generates an error.
Examples Insert Values from One Column This example inserts the columns from system.table_b into system.table_a.
SQL
Insert Values from Multiple Columns This example inserts the column system.table_b.id_col_b into system.table_a.id_col_a and system.table_b.int_col_b into system.table_a.int_col_a.
SQL
Insert Literal Values Create a table with product, quantity, and date of sale information with these non-nullable columns:
  • product — Product identifier
  • quantity — Quantity of the product sold
  • sale_date — Date of sale
SQL
Insert three rows of literal values that represent different sales.
SQL
Insert Values Using a Common Table Expression In this example, a common table expression performs calculations on the sales table before inserting rows into the monthly_sales_summary table. The example uses the monthly_sales_summary table created by this CREATE TABLE statement with these non-nullable columns:
  • product_id — Product identifier
  • month — Month part of the date
  • total_quantity — Total quantity of the product
SQL
The common table expression following the WITH keyword extracts the month from the sale date sale_date and calculates the sum of the quantity sold total_quantity of the product from the sales table before inserting this data. Then, the INSERT SQL statement specifies to insert the data into the monthly_sales_summary table.
SQL
Insert Columns Using Default Values This code utilizes the customers table with these columns:
  • customer_id — Customer identifier
  • name — Customer name
  • status — Customer status with the default active status
  • created_at — Created date
SQL
Use the DEFAULT VALUES keyword to insert one row of default values into the table. For columns that lack a defined default value, the operation inserts a NULL row.
SQL
The resulting row contains all NULL values except for the status column, which has the active default value.
SQL
Output
SQL
Alternatively, you can insert default values by using the DEFAULT keyword as one of the row values in the INSERT statement.
SQL
Output
SQL

INSERT INTO TABLE USING LOADERS

Specify one or more Loader Nodes for executing the INSERT INTO SQL statement. If you do not use this option, the Ocient System uses all Loader Nodes that are live to execute the SQL statement. This statement is useful for managing loading operations, particularly when balancing multiple loads of different sizes and resource requirements. Alternatively, this statement can also help simplify small batch loads by sourcing the data from a single Loader Node. Syntax
SQL
For the query to execute successfully, the specified names must:
  • Identify nodes that are live.
  • Identify nodes that have the Loader role.
Examples This example inserts the column system.table_b.id_col_b into system.table_a.id_col_a and system.table_b.int_col_b into system.table_a.int_col_a. Use the Loader Node named stream-loader1 to execute this SQL statement.
SQL
In this example, execute the same SQL statement with two Loader Nodes named stream-loader2 and stream-loader3.
SQL

TRUNCATE TABLE

TRUNCATE TABLE removes some or all records from an existing table in the current database. The system deletes the truncated data, but the table and its schema remain intact in the system even if all data is deleted. If the entire table is truncated, Global Dictionary Compression tables remain in place. To truncate a table, you must have the DELETE privilege for the table. To remove a subset of rows from a table, you can use the DELETE FROM TABLE SQL statement. For details and examples of using TRUNCATE, see Remove Records from an Ocient System.
This action cannot be undone and results in data loss.
Syntax
SQL
Examples This example truncates an existing table in the current database and schema named students.
SQL
This example truncates an existing table in the current database named us.students.
SQL
This example truncates a single segment group from an existing table in the current database named students.
SQL
This example truncates a number of segment groups from an existing table in the current database named us.students.
SQL
Data Query Language (DQL) Statement Reference Data Definition Language (DDL) Statement Reference Transactional Control Language (TCL) Statement Reference Commands Supported by the Ocient JDBC CLI Program Ocient Python Module (pyocient)
Last modified on June 24, 2026