SQLite3自己写的一些操作语句

前端之家收集整理的这篇文章主要介绍了SQLite3自己写的一些操作语句前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. 此句是创建表tabA,表tabB,

其中:

tabA:两个字段,id,name

tabB:三个字段,id,name,fkid

fkid:为外键,关联tabA的id,同时表tabB与表tabA级联更新、级联删除

db.execsql("create table if not exists tabA(" //创建表A,主键为ID

+ "id integer primary key,"
+ "name varchar(20))");

db.execsql("create table if not exists tabB(" //创建表B,主键为ID
+ "id integer primary key,"
+ "name varchar(20),"

+ "fkid varchar(20),foreign key(fkname) references tabA(id) On Delete CASCADE On Update CASCADE);");


2. 等待创建触发器

猜你在找的Sqlite相关文章