{ "name": "SS927TX", "workMode": " 0" }把json转数据库sql,创建表BaseCfg并填入10数据
时间: 2023-10-11 13:14:40 浏览: 41
将JSON转换为数据库SQL语句的代码如下:
```sql
CREATE TABLE BaseCfg (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
workMode VARCHAR(255)
);
INSERT INTO BaseCfg (name, workMode) VALUES ('SS927TX', '0');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS928TX', '1');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS929TX', '0');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS930TX', '1');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS931TX', '0');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS932TX', '1');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS933TX', '0');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS934TX', '1');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS935TX', '0');
INSERT INTO BaseCfg (name, workMode) VALUES ('SS936TX', '1');
```
这段代码将会创建名为BaseCfg的表,并将10条数据插入其中,其中第一条数据为题目所给的JSON对应的值。
阅读全文