sqlite语句

本文详细介绍了SQL的基本操作,包括如何查询数据,如使用LIKE进行模糊匹配,以及如何根据条件组合查询。同时,讲解了如何删除记录、新增数据以及更新表中的信息。还提到了如何查看表结构和添加新列。对于数据库管理,这些基本操作至关重要。
摘要由CSDN通过智能技术生成
  1. 查找语句
select id,strCN,strEN from String2 where strCN == '' 

从表String2中查找三列数据:id、strCN、strEN其中条件是strCN这一列为空。

查找语句还可以嵌套使用例如:

select id,strCN,strEN from String2 where strCN != '' and id not in (select id from String2 where strEN != '')

从表String2中查找三列数据:id、strCN、strEN。其中,条件是strCN不为空,并且id不在strEN为空的范围内。概括起来就讲,这个条件就是strCN不为空,strEN为空。

模糊查找语句

select id,strCN,strEN from String2 where strCN like ‘%\n%

从表String2中查找三列数据:id、strCN、strEN。其中,条件是词条中包含有’\n’。

  1. 删除语句
delete from String2 where id == 100

从表String2中删除id为100的项。

  1. 增加一个项语句
insert into String2 (id,strEN) values ('1044055','camshaft position actuator circuit')

向String2中添加一条,该条数据是:id是1044055,strEN为camshaft position actuator circuit。

  1. 更新一条数据
update String set strFR = '' where id = 1080692

更新表String中的strFR列。其中,条件是id等于1080692。

  1. 列出一个表的信息
pragma table_info([StringAttrib_Brand])

列出表StringAttrib_Brand的信息

  1. 给某张表增加一列
alter table StringAttrib_Brand add column strD

在表StringAttrib_Brand中新增一列名字为strD

  1. 获得某张表中主键的最大值
Select max(id) from String

说明:从表String中获得主键id的最大值
备注:屏蔽一个语句用“–”

  1. 将某一列的数据复制到一个新的列中去
update String set strDU=strNE where id = 100

说明:将String表中id=100的strEN列数据复制到strDU列中去

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值