Sqlite语法
源地址:http://www.cnblogs.com/helloandroid/articles/2150272.html id字段自增 sql="CREATE TABLE IF NOT EXISTS MusicList (id integer primary key AutoIncrement,name varchar(20),path 20))";
desc <table> //查看表结构 select * from //查询所有更 select,from table ;//查看指定列 select distinct,128)">//非重复查询 insert into users(_id,username,password) from users;//复制 select username from users where username like 'S%' ;//非重名字首字母为大写S的用户 __S%//非重名字第三个字母为大写S的用户 where _id in(001,220,0)">230); from user order by _id;//以id的顺序排列 by _id desc;//以id反的顺序排 分页当数据库数据量很大时,分页显示是个很简单且符合人们习惯的一种处理方法。获取数据行总数:最简单的方法是:SELECT所有的行,再调用curosr.getCount() ;取得行数,但这样效率会很低。 SQLite为我们提供了一个函数很容易查出总共有多少行。有个名为cet6_table的表格,我们想知道总共有多少行的word;可以使用如下 语句来完成:SELECT count(word) AS number FROM cet6_table; count()函数为我们返回一个Int整形,代表有多少行数据。返回的列的名字叫count(word),为了方便阅读和处理用as number给这个列取个 别名number; [word],explanation] FROM cet6_table ORDER BY word LIMIT 100 OFFSET 200"上语句,返回自第200行的最多100条数据。分页时我们只要修改offset 后面的数据即可取得对应页面的数据。 SQLite内建语法表 |