Sqlite常规操作 add update select

用到了数据库,花了好长时间才搞定,把遇到的问题记录一下,sqlite语法:

select,最简单的语句

select * from table where condition

add

add中有两个需求

1.没有表的时候创建表

create table if not exists

2.如果存在则更新,不存在就插入

insert or replace into table ()values()

这里需要配合 primary key,用unique会报错

3.update

update table set x = x where condition

 

多次遇到 near syntax error,这些肯定是语法拼写错误,请仔细检查。

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注