前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SQLite 基础11

SQLite 基础11

作者头像
franket
发布2021-12-01 17:28:30
1850
发布2021-12-01 17:28:30
举报
文章被收录于专栏:技术杂记

再进行查询

代码语言:javascript
复制
sqlite> select * from company;
id          name        age         address     salary    
----------  ----------  ----------  ----------  ----------
1           Paul        32          California  20000.0   
2           Allen       25          Texas       15000.0   
3           Teddy       23          Norway      20000.0   
4           Mark        25          Rich-Mond   65000.0   
5           David       27          Texas       85000.0   
6           Kim         22          South-Hall  45000.0   
7           James       24          Houston     10000.0   
sqlite> 

格式明显变工整了

代码语言:javascript
复制
sqlite> select name,salary,id from company;
name        salary      id        
----------  ----------  ----------
Paul        20000.0     1         
Allen       15000.0     2         
Teddy       20000.0     3         
Mark        65000.0     4         
David       85000.0     5         
Kim         45000.0     6         
James       10000.0     7         
sqlite> 

设置列宽

代码语言:javascript
复制
sqlite> .width 6 , 15, 10
sqlite> select name,salary,id from company;
name    salary      id             
------  ----------  ---------------
Paul    20000.0     1              
Allen   15000.0     2              
Teddy   20000.0     3              
Mark    65000.0     4              
David   85000.0     5              
Kim     45000.0     6              
James   10000.0     7              
sqlite>

隐藏的信息管理表

代码语言:javascript
复制
sqlite> .schema sqlite_master
CREATE TABLE sqlite_master (
  type text,
  name text,
  tbl_name text,
  rootpage integer,
  sql text
);
sqlite> 

这张表里包含了其它表的信息

代码语言:javascript
复制
sqlite>  select * from sqlite_master;
type        name        tbl_name    rootpage    sql                                                         
----------  ----------  ----------  ----------  ------------------------------------------------------------
table       test        test        2           CREATE TABLE test ( id int primary key not null, name text )
index       sqlite_aut  test        3                                                                       
table       hello       hello       6           CREATE TABLE hello (
id int primary key not null,
age int,
n
index       sqlite_aut  hello       7                                                                       
table       ui          ui          8           CREATE TABLE ui(
id int,
name text,
age int)                
table       company     company     9           CREATE TABLE company(
id int primary key not null,
name text
index       sqlite_aut  company     10                                                                      
table       department  department  11          CREATE TABLE department(
id int primary key not null,
dept c
index       sqlite_aut  department  12                                                                      
sqlite> 

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 设置列宽
  • 隐藏的信息管理表
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档