Create, Drop table
The HTTP “Query” API doesn’t accept only “SELECT” SQL but also DDL. So it is possible to create and drop tables via HTTP API
Create table
Please refer to the docs for understanding what is the Tag Tables
Request
```http
GET http://127.0.0.1:5654/db/query
?q=create tag table EXAMPLE (name varchar(40) primary key, time datetime basetime, value double)
```
curl -o - http://127.0.0.1:5654/db/query \
--data-urlencode \
"q=create tag table EXAMPLE (name varchar(40) primary key, time datetime basetime, value double)"
Response
{"success":true,"reason":"Created successfully.","elapse":"92.489922ms"}
IF NOT EXISTS
```http
GET http://127.0.0.1:5654/db/query
?q=create tag table if not exists EXAMPLE (name varchar(40) primary key, time datetime basetime, value double)
```
curl -o - http://127.0.0.1:5654/db/query \
--data-urlencode \
"q=create tag table if not exists EXAMPLE (name varchar(40) primary key, time datetime basetime, value double)"
TAG STATISTICS
```http
GET http://127.0.0.1:5654/db/query
q=create tag table EXAMPLE (name varchar(40) primary key, time datetime basetime, value double summarized)
```
curl -o - http://127.0.0.1:5654/db/query \
--data-urlencode \
"q=create tag table EXAMPLE (name varchar(40) primary key, time datetime basetime, value double summarized)"
📢
Note The keyword “summarized” refers to the automatic generation of statistics on the internal tag data structure when data is written into the corresponding tag table. For more detailed information, please refer to the link below. Tag Statistics
Drop table
Request
```http
GET http://127.0.0.1:5654/db/query
?q=drop table EXAMPLE
```
curl -o - http://127.0.0.1:5654/db/query \
--data-urlencode "q=drop table EXAMPLE"
Response
{"success":true,"reason":"Dropped successfully.","elapse":"185.37292ms"}
Last updated on