sqlite

  1. sqlite>.tables                                                --查看当前数据库所有表  
  2. sqlite>.tables table_name                                     --查看当前数据库指定表  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>.schema                                                --查看当前数据库所有表的建表(CREATE)语句  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>.schema table_name                                     --查看指定数据表的建表语句  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select * from sqlite_master from;                      --查看所有表结构及索引信息  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select * from sqlite_master where type='table';        --查看所有表结构信息  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select name from sqlite_master where type='table';     --对于表来说,name字段指表名,查询所有表  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select * from sqlite_master where type='table' and name='table_name';     --查看指定表结构信息  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select * from sqlite_master where type='index';        --查看所有表索引信息,查询所有索引  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select name from sqlite_master where type='table';     --对于索引来说,name字段指索引名  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select * from sqlite_master where type='index' and name='table_name'; --查看指定表索引信息  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>pragma table_info ('table_name')                       --查看指定表所有字段信息,类似于msyql:desc table_name  
[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. sqlite>select typeof('column') from table_name;               --查看指定表字段【column】类型,括号内可不输引号  

版权声明:本文为qq_31298925原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。