Before executing the following SQL statements, please ensure
- IoTDB service has been successfully started
- Connected to IoTDB via Cli client
Note: If your terminal does not support multi-line pasting (e.g., Windows CMD), please adjust the SQL statements to single-line format before execution.
-- Create database; CREATE DATABASE root.ln; -- View database; SHOW DATABASES root.**; -- Delete database; DELETE DATABASE root.ln; -- Count database; COUNT DATABASES root.**;
For detailed syntax description, please refer to: Database Management
-- Create time series; CREATE TIMESERIES root.ln.wf01.wt01.status BOOLEAN; CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT; -- Create aligned time series; CREATE ALIGNED TIMESERIES root.ln.wf01.GPS(latitude FLOAT, longitude FLOAT); -- Delete time series; DELETE TIMESERIES root.ln.wf01.wt01.status; -- View time series; SHOW TIMESERIES root.ln.**; -- Count time series; COUNT TIMESERIES root.ln.**;
For detailed syntax description, please refer to: Time Series Management
-- Single column writing; INSERT INTO root.ln.wf01.wt01(timestamp, temperature) VALUES(1, 23.0),(2, 42.6); -- Multi-column writing; INSERT INTO root.ln.wf01.wt01(timestamp, status, temperature) VALUES (3, false, 33.1),(4, true, 24.6);
For detailed syntax description, please refer to: Data Writing
-- Time filter query; SELECT * from root.ln.** where time > 1; -- Value filter query; SELECT temperature FROM root.ln.wf01.wt01 where temperature > 36.5; -- Function query; SELECT count(temperature) FROM root.ln.wf01.wt01; -- Latest point query; SELECT LAST status FROM root.ln.wf01.wt01;
For detailed syntax description, please refer to: Data Query
-- Single column deletion; DELETE FROM root.ln.wf01.wt01.status WHERE time >= 20; -- Multi-column deletion; DELETE FROM root.ln.wf01.wt01.* where time <= 10;
For detailed syntax description, please refer to: Data Deletion