加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

sqlite3语法小结

发布时间:2020-12-12 20:22:27 所属栏目:百科 来源:网络整理
导读:SQLite3不支持的SQL语法请参考:http://hyshang.blog.163.com/blog/static/4594582220121311728522/ 自己做过的测试: 在SQLite3中统计总的行数 select COUNT (*) AS linenum from Table_name 生成的结果有一行一列,字段名为linenum,内容为行数的字符串
SQLite3不支持的SQL语法请参考:http://hyshang.blog.163.com/blog/static/4594582220121311728522/
自己做过的测试:
在SQLite3中统计总的行数 select COUNT (*) AS linenum from Table_name 生成的结果有一行一列,字段名为linenum,内容为行数的字符串
在SQLite3中显示前N行 select * from table_name limit N
显示从第N条开始的M条记录 select * from table_name limit N,M //N序号从0开始 在sqlite3中构建rowid: select rowid,* from table_name //最左边一列段名为rowid,从1开始 select rowid [as column_name] from table_name //只有一列段名为rowid,从1开始 sqlite不支持rownum,但是可以使用rowid和limit组合实现rownum的功能 sqlite rowid的功能参考: http://www.sqlite.org/lang_createtable.html#rowid
删除某段范围的记录 delete from system where rowid in (select rowid from system limit N,M)
删除某表的所有行 delete from table_name 不支持 delete * from table_name 不支持 Truncate table name
关闭数据库之后调用free_table是安全的 邮件列表上的问题http://readlist.com/lists/sqlite.org/sqlite-users/3/17854.html sqlite3_open();
sqlite3_get_table(...result....);
sqlite3_close();
sqlite3_free_table(result);
一次插入多行数据 INSERT INTO table_name (‘culumn_name1’, 'column_name2') VALUES (xxx,xxx),(xxx,xxx) exp: insert into CFG ('CfgName','CfgValue') VALUES ('days',365),('number',30000)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读