部分常用到的SQLite语句

前端之家收集整理的这篇文章主要介绍了部分常用到的SQLite语句前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

drop table if exists learning_new4;

create table learning_new4(id INTEGER default 1 primary key AUTOINCREMENT,sTtile text,sContent text,sort text);

insert into learning_new4(sTtile,sContent,sort) select sTtile,sort from learning_new3 order by sort desc;


// 从这个表中选取一部分字段,然后放到一个新生成的表中

drop table if exists FullNew;

create table FullNew(id INTEGER DEFAULT 1 PRIMARY KEY AUTOINCREMENT,sTitle varchar(80),sContent memo,sort TEXT);

insert into FullNew(sTitle,sort) select field2,field3,field4 from learning_new4 order by field4 desc;



// 创建新表从已有表中。

drop table if exists duanxinleyuan;

create table duanxinleyuan(id INTEGER DEFAULT 1 PRIMARY KEY AUTOINCREMENT,sContent memo);

insert into duanxinleyuan(sTitle,sContent) select sTitle,sContent from FullNew where id between 1 and 59;



// 把FullNew中的id为60到140之间的行插入到已有表的末尾

insert into duanxinleyuan(sTitle,sContent from FullNew where id between 60 and 140;


// 如我想删除AID=50~150之间的100条记录

// 删除行数据

DELETE FROM A WHERE chapterid > 49 AND chapterid < 151


// 从已有表中进行倒序,生成新表, 按id倒序

drop table if exists guihua_des;

create table guihua_des(id INTEGER default 1 primary key AUTOINCREMENT,sContent memo);

insert into guihua_des(sTitle,sContent from guihua order by id desc;

原文链接:https://www.f2er.com/sqlite/201473.html

猜你在找的Sqlite相关文章