pg库、MySQL库和sqlite3基本操作

147 阅读1分钟

1 pg库基本操作

(1)查看所有表:\dt;

(2)查看某个表的表结构:\d table_name_tmp;或者select table_name from information_schema.tables

(3)切换横版或竖版显示查询结果:\x

(4)退出:\q

2 MySQL库基本操作

(1)查看所有表:show tables;

(2)查看某个表的表结构:desc table_name_tmp;

(3)竖版显示查询结果:select * from table_name_tmp\G;

(4)退出:quit

3 sqlite3基本操作

(1)查看所有的表:.tables或者select name from sqlite_master where type = 'table';

(2)查看某个表的表结构:.schema table_name或者PRAGMA table_info(table_name);

(3)退出:.q或者.quit

(4)带上字段名:.headers on

(5)竖版查询结果:.mode line