This is the multi-page printable view of this section. Click here to print.
Return to the regular view of this page.
本章介绍数据操作相关的 SQL.
写入数据的基础语法如下:
1 2 3
INSERT [INTO] tbl_name [(col_name [, col_name] ...)] { {VALUES | VALUE} (value_list) [, (value_list)] ... }
写入一行数据的示例如下:
1
INSERT INTO demo(`timestamp`, tag1) VALUES(1667374200022, 'horaedb')
数据查询的基础语法如下:
1 2 3 4 5 6 7
SELECT select_expr [, select_expr] ... FROM table_name [WHERE where_condition] [GROUP BY {col_name | expr} ... ] [ORDER BY {col_name | expr} [ASC | DESC] [LIMIT [offset,] row_count ]
数据查询的语法和 mysql 类似,示例如下:
SELECT * FROM `demo` WHERE time_stamp > '2022-10-11 00:00:00' AND time_stamp < '2022-10-12 00:00:00' LIMIT 10