首页 > 代码库 > sqlite常用查询

sqlite常用查询

  做的小工具用到了sqlite,在查询上较sqlserver还是稍有差异,将常用操作汇总一下,慢慢收集和整理。  

--查询版本
SELECT sqlite_version() AS ‘SQLite Version‘;

CREATE
TABLE [Users] ( [ID] integer, [UserName] nvarchar(254), [Password] nvarchar(254), [Group] int);insert into users values(1,test1,password,1);insert into users values(2,test2,password,3);insert into users values(3,test3,password,1);insert into users values(4,test4,password,2);


--字段拼接 ||select username||-||password as userinfo from users
--多行合并 Group_CONCATSELECT [group],GROUP_CONCAT(username) users FROM users GROUP BY [group]

 

--top select * from users limit 0,3

 

sqlite常用查询