做的小工具用到了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_CONCAT
SELECT [group],GROUP_CONCAT(username) users FROM users GROUP BY [group]

 

--top 
select * from users limit 0,3

 

--转义
insert into users values(5,'test''s','passowrd',2)
select * from users where username='test''s'

 

相关文章:

  • 2021-12-28
  • 2021-07-05
  • 2021-06-08
  • 2021-11-29
  • 2022-02-12
  • 2021-07-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-03
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案