数据库Sqlite下面的相关操作:
1,进入数据库操作界面: sqlite3 数据库名
2,查看所有表名: .tables
3,查看表内容: select * from 表名
4,查看所有表的结构: select * from sqlite_master WHERE type = “table”

[root@xx db]# sqlite3 sampledb.db.sqlite3     说明:进入数据库(sampledb.db.sqlite3)   
SQLite version 3.x.17 20xx-05-20 00:56:22         
Enter ".help" for instructions         
Enter SQL statements terminated with a ";"         
sqlite> .tables                               说明:查看所有表名   
sampletbl1  sampletbl2         
sqlite> select * from sampletbl1;             说明:查看表sampletbl1的数据 
1|data1|value1|2020-03-03 13:46:32|2020-03-13 13:46:32         
2|data2|value2|2020-03-03 08:32:19|2020-03-03 08:32:19         
sqlite> select * from sampletbl2;             说明:查看表sampletbl2的数据
1|data21|value21|2020-03-03 13:29:57|2020-03-13 13:29:57         
2|data22|value22|2020-03-05 02:14:06|2020-03-05 02:14:06         
         
sqlite> select * from sqlite_master WHERE type = "table";      说明:查看所有表结构   
table|sampletbl1|sampletbl1|2|CREATE TABLE `sampletbl1` (         
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,         
  `data` varchar(10) NOT NULL,         
  `value` varchar(20) NOT NULL,         
  `ctime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,         
  `utime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP)         
table|sqlite_sequence|sqlite_sequence|3|CREATE TABLE sqlite_sequence(name,seq)         
table|sampletbl2|sampletbl2|4|CREATE TABLE `sampletbl2` (         
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,         
  `data` varchar(10) NOT NULL,         
  `value` varchar(20) NOT NULL,         
  `ctime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,         
  `utime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP         
)         

更多推荐