读书人

Sqlite 小札记

发布时间: 2012-08-19 21:09:48 作者: rapoo

Sqlite 小笔记
1.如何查询Sqlite 数据库中的所有表信息
From within a c/c++ program (or a scritpt using tcl/Ruby/Perl/Python bindings),you can get access to table and index names by doing a select on a special table named "SQULITE_MASTER",Every SQLite database has an SQLITE_MASTER table that defines the schema for the database ;

比如:
sqlite> select name from sqlite_master where type='table' order by name;
name = carts
name = line_items
name = orders
name = products
name = schema_migrations
name = sqlite_sequence

>>>>>=======================================
或者直接使用此命令 .tables
或者使用简写 .tab
sqlite> .tables
carts orders schema_migrations
line_items products users

2.如何删除Sqlite 数据库中某一张表中的所有数据
命令 delete from table_name;
sqlite > delete from users;

读书人网 >SQL Server

热点推荐