频道栏目
首页 > 程序开发 > 移动开发 > Android > 正文
Android开发相关:(06)快速了解SQLite
2012-04-24 09:48:45           
收藏   我要投稿
[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 ....



摘自 horsttnann的专栏
点击复制链接 与好友分享!回本站首页
上一篇:Android开发相关:(05)可用的shell命令集
下一篇:Android开发相关:(07)dp与px转换
相关文章
图文推荐
点击排行

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站