You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The above SQL writes `2018-10-03 14:38:05`, `10.3`, `219`, `0.31` into the columns `ts`, `current`, `voltage`, `phase` of the subtable `d1001`.
23
+
The above SQL writes `2018-10-03 14:38:05`, `10.3`, `219`, `0.31` into the columns `ts`, `current`, `voltage`, `phase` of the subtable `d1001`.
24
24
25
25
1. When the `VALUES` part of the `INSERT` statement includes all columns of the table, the list of fields before `VALUES` can be omitted, as shown in the following SQL statement, which has the same effect as the previous INSERT statement specifying columns.
1. For the table's timestamp column (the first column), you can also directly use the timestamp of the database precision.
32
32
33
-
```sql
34
-
INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31);
35
-
```
33
+
```sql
34
+
INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31);
35
+
```
36
36
37
37
The effects of the above three SQL statements are exactly the same.
38
38
@@ -41,10 +41,10 @@ The effects of the above three SQL statements are exactly the same.
41
41
Assume that the smart meter with device ID d1001 collects data every 10s and reports data every 30s, i.e., it needs to write 3 records every 30s. Users can write multiple records in one insert statement. The following SQL writes a total of 3 records.
42
42
43
43
```sql
44
-
insert into d1001 values
45
-
("2018-10-03 14:38:05", 10.2, 220, 0.23),
46
-
("2018-10-03 14:38:15", 12.6, 218, 0.33),
47
-
("2018-10-03 14:38:25", 12.3, 221, 0.31)
44
+
INSERT INTO d1001 VALUES
45
+
("2018-10-03 14:38:05", 10.2, 220, 0.23),
46
+
("2018-10-03 14:38:15", 12.6, 218, 0.33),
47
+
("2018-10-03 14:38:25", 12.3, 221, 0.31);
48
48
```
49
49
50
50
The above SQL writes a total of three records.
@@ -76,18 +76,18 @@ The above SQL writes a total of nine records.
76
76
You can write data to specific columns of a table by specifying columns. Columns not appearing in the SQL will be automatically filled with NULL values. Note that the timestamp column must be present, and its value cannot be NULL. The following SQL writes one record to the subtable d1004. This record only includes voltage and phase, with the current value being NULL.
77
77
78
78
```sql
79
-
insert into d1004 (ts, voltage, phase) values("2018-10-04 14:38:06", 223, 0.29)
79
+
INSERT INTO d1004 (ts, voltage, phase) VALUES("2018-10-04 14:38:06", 223, 0.29);
80
80
```
81
81
82
82
### Automatic Table Creation on Insert
83
83
84
84
Users can perform inserts using the `using` keyword for automatic table creation. If the subtable does not exist, it triggers automatic table creation before data insertion; if the subtable already exists, it directly inserts the data. An insert statement with automatic table creation can also specify only some tag columns for insertion, leaving the unspecified tag columns as NULL values. The following SQL inserts a record. If the subtable d1005 does not exist, it first creates the table automatically with the tag `group_id` value as NULL, then inserts the data.
85
85
86
86
```sql
87
-
insert into d1005
88
-
using meters (location)
89
-
tags ( "beijing.chaoyang")
90
-
values ( "2018-10-04 14:38:07", 10.15, 217, 0.33)
87
+
INSERT INTO d1005
88
+
USING meters (location)
89
+
TAGS ("California.SanFrancisco")
90
+
VALUES ("2018-10-04 14:38:07", 10.15, 217, 0.33);
91
91
```
92
92
93
93
The insert statement with automatic table creation also supports inserting data into multiple tables in one statement. The following SQL uses an automatic table creation insert statement to insert 9 records.
TDengine also supports direct data insertion into supertables. It is important to note that a supertable is a template and does not store data itself; the data is stored in the corresponding subtables. The following SQL inserts a record into the subtable d1001 by specifying the tbname column.
114
114
115
115
```sql
116
-
insert into meters (tbname, ts, current, voltage, phase, location, group_id)
To facilitate the cleanup of abnormal data caused by equipment failures and other reasons, TDengine supports deleting time-series data based on timestamps. The following SQL deletes all data in the supertable `meters` with timestamps earlier than `2021-10-01 10:40:00.100`. Data deletion is irreversible, so use it with caution. To ensure that the data being deleted is indeed what you want to delete, it is recommended to first use a select statement with the deletion condition in the where clause to view the data to be deleted, and confirm it is correct before executing delete.
135
135
136
136
```sql
137
-
delete from meters where ts < '2021-10-01 10:40:00.100';
137
+
DELETEFROM meters WHERE ts <'2021-10-01 10:40:00.100';
Copy file name to clipboardExpand all lines: docs/en/08-operation/09-backup.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ TDengine Enterprise implements incremental backup and recovery of data by using
38
38
1. Incremental data backup: Based on TDengine's data subscription function, all data changes of **the backup object** (including: addition, modification, deletion, metadata change, etc.) are recorded to generate a backup file.
39
39
2. Data recovery: Use the backup file generated by incremental data backup to restore **the backup object** to a specified point in time.
40
40
3. Backup object: The object that the user backs up can be a **database** or a **supertable**.
41
-
4. Backup plan: The user creates a periodic backup task for the backup object. The backup plan starts at a specified time point and periodically executes the backup task at intervals of **the backup cycle. Each backup task generates a****backup point** .
41
+
4. Backup plan: The user creates a periodic backup task for the backup object. The backup plan starts at a specified time point and periodically executes the backup task at intervals of **the backup cycle.** Each backup task generates a **backup point** .
42
42
5. Backup point: Each time a backup task is executed, a set of backup files is generated. They correspond to a time point, called **a backup point** . The first backup point is called **the initial backup point** .
43
43
6. Restore task: The user selects a backup point in the backup plan and creates a restore task. The restore task starts from **the initial backup point** and plays back the data changes in **the backup file** one by one until the specified backup point ends.
Copy file name to clipboardExpand all lines: docs/en/08-operation/10-disaster.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,4 @@ The following steps describe how to easily set up a data disaster recovery syste
30
30
31
31
- Step 5: Add a data synchronization task on the "System Management - Data Synchronization" page of the taosExplorer service, fill in the configuration information of the task with the database db1 to be synchronized and the target database db2's DSN, and start data synchronization after creating the task.
32
32
33
-
- Step 6: Access Cluster B, and you can see that the database db2 in Cluster B continuously writes data from the database db1 in Cluster A until the data volumes of the databases in both clusters are roughly equal. At this point, a simple data disaster recovery system based on
34
-
35
-
TDengine Enterprise is set up.
33
+
- Step 6: Access Cluster B, and you can see that the database db2 in Cluster B continuously writes data from the database db1 in Cluster A until the data volumes of the databases in both clusters are roughly equal. At this point, a simple data disaster recovery system based on TDengine Enterprise is set up.
0 commit comments