DML
Is used to manipulate data stored in a database.
INSERT
CnosDB requires the inserted data columns to have a timestamp and the VALUES
list must be constant. If a column is not selected, the value is NULL
.
The time column cannot be NULL
, TAG
column and FIELD
column can be NULL
.
For example, INSERT INTO air (TIME, station, visibility) VALUES(1666132800000000000, NULL, NULL)
If the VALUES
list needs an expression, use the INSERT SELECT
syntax.
INSERT [INTO] tb_name [ ( column_name [, ...] ) ] VALUES ( const [, ...] ) [, ...] | select_statment;
View the INSERT
example
UPDATE
Cannot update TAG
column and FIELD
column simultaneously.
CnosDB supports updating TAG
column values to NULL.
value_expression
can only be an expression with a value that can be determined at compile time, such as: 'constant', '1 + 2', 'CAST('1999-12-31 00:00:00.000' as timestamp)' etc.
where_clause
cannot contain field column or time column, must not be empty, if you want to update all data in the table, use 'where true', which means you accept the performance issues when the table data is large.
Cannot modify to an existing series (all TAG
column values form a series).
Avoid performing TAG
operations when writing data, as it may cause series conflicts.
UPDATE table_name SET ( assignment_clause [, ...] ) where_clause
assignment clause :
tag_name = value_expression
View the UPDATE
example
DELETE
Cannot delete data with FIELD
type columns as conditions.
DELETE FROM table_name where_clause