# SQLite 增删改查

# 增 INSERT

insert into table [(column)] values(value)

INSERT INTO TABLE_NAME [(column1, column2, column3,...columnN)]
VALUES (value1, value2, value3,...valueN);
var sqlite3 = require("sqlite3");
var db = new sqlite3.Database("./db/test1.db", function () {
  db.run("create table user(name varchar(15))", function () {
    db.run("insert into user values('gausshou')", function () {
      db.all("select * from user", function (err, res) {
        if (!err) console.log(JSON.stringify(res));
        else console.log(err);
      });
    });
  });
});

# 删 DELETE

delete from table where [condition]

DELETE FROM table_name
WHERE [condition];

# 改 UPDATE

update table set column = value where [condition]

UPDATE table_name
SET column1 = value1, column2 = value2, columnN = valueN
WHERE [condition];

# 查 SELECT

SELECT * FROM table_name;
SELECT ID, NAME, SALARY FROM COMPANY;