分类: SQLite/嵌入式数据库
2011-04-13 10:39:21
下面的SQL命令可以帮助你快速的查看SQLite数据库
//查看数据库所包含的表:
.tables
//查看表的sql代码:
.schema
//让字段名显示
Sqlite>.headers on
//选择数据表里面所有记录
Select * from table1;
//返回记录的条数
Select count(*) from table1;
//返回特定的字段
Select col1, col2 from table1;
//返回唯一值
Select distinct col1 from table1;
//返回唯一值的记录个数
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;
//左外联
//返回所有t1表里面的记录,即使在t2表里面没有对应的值
Select * from table t1 left outer join table2 t2
On t1.col1 = t2.col1
Where …