打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
sqlite中如何查询数据库中存在的所有表?(转自:http://topic.csdn.net/u/20081231/16/6aee6233-32c2-4f20-a3d7-0cb154974ce4.)
userphoto

2012.05.18

关注
  1. 官方文档就有。  
  2.   
  3. http://www.sqlite.org/faq.html  
  4.   
  5. (7) How do I list all tables/indices contained in an SQLite database  
  6.   
  7. If you are running the sqlite3 command-line access program you can type ".tables" to get a list of all tables. Or you can type ".schema" to see the complete database schema including all tables and indices. Either of these commands can be followed by a LIKE pattern that will restrict the tables that are displayed.  

  1. From within a C/C++ program (or a script using Tcl/Ruby/Perl/Python bindings) you can get access to table and index names by doing a SELECT on a special table named "SQLITE_MASTER". Every SQLite database has an SQLITE_MASTER table that defines the schema for the database.  
  2.   
  3. SQL code  
  4. SELECT name FROM sqlite_master  
  5. WHERE type='table'  
  6. ORDER BY name;  
  7.   
  8.   
  9.   
  10.   
  11. 如果你在sqlite行命令下,你可以直接使用 .tables 或 .schema 命令来得到完整的数据库集包括表s和索引s. 这两个命令支持匹配符。  
  12. 如果在其它宿主程序中例如 C/C++等,你可以从一个特殊的表 "SQLITE_MASTER" 得到类似的信息  
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
PowerDesigner16逆向工程生成PDM列注释(My Sql5.0模版)
浅谈PostgreSQL用户权限
keeping a log table in sqlite database?
SQL注入新手教程
SQLite 删除表 | w3cschool菜鸟教程
Flask使用SQLite数据库
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服