灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:2883回复:0

Android开发相关:(06)快速了解SQLite

楼主#
更多 发布于:2012-09-06 13:54

[sql] // Set the column headers to show in the tool
sqlite>. headers on

// select all rows from a table
select * from table1;

// count the number of rows in a table
select count(*) from table1;

// select a specific set of columns
select col1, col2 from table1;

// select distinct values in a column
select distinct col1 from table1;

// counting the distinct valus
select count(col1) from (select distinct col1 from table1);

// group by
select count(*), col1 from table1 group by col1;

// regular inner join
select * from table1 t1, table2 t2 where t1.col1 = t2.col1;

// left outer join
// give me everything in t1 even though there are no rows in t2
select * from table t1 left outer join table2 t2 on t1.col1 = t2.col1 where ....
// Set the column headers to show in the tool
sqlite>. headers on

// select all rows from a table
select * from table1;

// count the number of rows in a table
select count(*) from table1;

// select a specific set of columns
select col1, col2 from table1;

// select distinct values in a column
select distinct col1 from table1;

// counting the distinct valus
select count(col1) from (select distinct col1 from table1);

// group by
select count(*), col1 from table1 group by col1;

// regular inner join
select * from table1 t1, table2 t2 where t1.col1 = t2.col1;

// left outer join
// give me everything in t1 even though there are no rows in t2
select * from table t1 left outer join table2 t2 on t1.col1 = t2.col1 where ....




喜欢0 评分0
游客

返回顶部