Android笔记 SQLite总结 ,字带数据库,附记事本,字典小程序


SQLite Database

SQLite is an embedded relational database engine. Its developers call it a self-contained, serverless, zero-configuration and transactional SQL database engine. 其实只需要记住SQLite不需要数据库服务器,不需要额外配置,其数据库本身就是一个文件的一个小型数据库。通常情况下在Android中创建数据库,系统会在"DATA/data/APP_NAME/databases".目录为我们创建数据库文件。

本文源码下载

免费下载地址在 http://linux.bkjia.com/

用户名与密码都是www.bkjia.com

具体下载目录在 /2011年资料/Android入门教程/Android笔记 SQLite总结 ,字带数据库,附记事本,字典小程序/

SQLite Basic

DataTypes

SQLite支持的数据类型有很多,但他们总共可以分为以下几类:
desc <table> //查看表结构 
select * from <table> //查询所有更
select , from table ;//查看指定列
select distinct , from table ;//非重复查询
insert into users(_id,username,password) select * from users;//复制
select username from users where username like 'S%' ;//非重名字首字母为大写S的用户
select username from users where username like '__S%' ;//非重名字第三个字母为大写S的用户
select * from users where _id in(001,220,230);
select * from user order by _id;//以id的顺序排列
select * from user order by _id desc;//以id反的顺序排
常用Select语句
desc <table> //查看表结构 
select * from <table> //查询所有更
select , from table ;//查看指定列
select distinct , from table ;//非重复查询
insert into users(_id,username,password) select * from users;//复制
select username from users where username like 'S%' ;//非重名字首字母为大写S的用户
select username from users where username like '__S%' ;//非重名字第三个字母为大写S的用户
select * from users where _id in(001,220,230);
select
* from user order by _id;//以id的顺序排列
select * from user order by _id desc;//以id反的顺序排

图形环境

很少有人直接在程序当中直接编写SQL语句,麻烦且容易出错。所以最好应该先在一个图形化的环境把SQL语句写好,测试好再加入到代码当中。 而且,SQLite数据库本身就是一个独立的文件,很容易从模拟器上抓取出来。可以使用图形化界面进行分析,和修改 etc.
SQLite expert 是个简单小巧的SQLite数据库管理软件,有免费版和,收费版两种,一般来讲免费版足以应付我们需求。
sqliteexpert官方网址

软件界面截图

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 下一页

相关内容