1、.help 命令:查看所有点命令

 

2、 .open 命令:  打开或者创建.db文件

xuanmiao363@xuanmiao:~/Test/Sqlite$ ls
Cars  sql_1  sql_1.c  test.db
xuanmiao363@xuanmiao:~/Test/Sqlite$ sqlite3 
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open new.db
sqlite> .quit
xuanmiao363@xuanmiao:~/Test/Sqlite$ ls
Cars  new.db  sql_1  sql_1.c  test.db

 

3、.tables 命令:查看db中存在的所有表

sqlite> .tables
AirPlanes  Cars 

 

4、.schema 命令: 查看表的数据类型

xuanmiao363@xuanmiao:~/Test/Sqlite$ sqlite3 test.db 
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> .schema Cars
CREATE TABLE Cars(Id INT, Name TEXT, Price INT);
sqlite> 

 

5、.headers on/off 命令:开启/关闭表头显示

sqlite> .headers off
sqlite> SELECT * from Cars;
1|Audi|52642
2|Mercedes|57127
3|Skoda|9000
4|Volvo|29000
5|Bentley|350000

sqlite> 
sqlite> .headers on
sqlite> SELECT * from Cars;
Id|Name|Price
1|Audi|52642
2|Mercedes|57127
3|Skoda|9000
4|Volvo|29000
5|Bentley|350000
sqlite>  

 

6、以列的格式分栏显示

sqlite> .mode column
sqlite> SELECT * from Cars;
Id          Name        Price     
----------  ----------  ----------
1           Audi        52642     
2           Mercedes    57127     
3           Skoda       9000      
4           Volvo       29000     
5           Bentley     350000    

 

posted on 2025-05-24 19:18  轩~邈  阅读(17)  评论(0)    收藏  举报