当前位置:数据库 > SQLite >>

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

[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 ,
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,