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

SQLite 基础8

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

附加数据库

sqlite可以对多个数据库(多个文件)进行操作

代码语言:javascript
复制
sqlite> .databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /usr/local/sqlite3.11/bin/test.db                         
sqlite>
sqlite> attach database 'test_tmp.db' as 'abc';
sqlite> .databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /usr/local/sqlite3.11/bin/test.db                         
2    abc              /usr/local/sqlite3.11/bin/test_tmp.db                     
sqlite> .tables
abc.test  test    
sqlite> select * from abc.test;
1|hello
2|hello
3|hello
4|hello
5|hello
sqlite> select * from test;
1|hello
2|hello
3|hello
4|hello
5|hello
sqlite> create table t2(id int primary key not null, name text );
sqlite> .tables
abc.test  t2        test    
sqlite> create table abc.t2(id int primary key not null, name text );  
sqlite> .tables
abc.t2    abc.test  t2        test    
sqlite> 
sqlite> INSERT INTO abc.t2  VALUES(1,'hello');
sqlite> INSERT INTO abc.t2  VALUES(3,'hello');
sqlite> INSERT INTO abc.t2  VALUES(5,'hello');
sqlite> 
sqlite> INSERT INTO t2 VALUES(2,'hello');
sqlite> INSERT INTO t2 VALUES(4,'hello');
sqlite> select * from abc.t2;
1|hello
3|hello
5|hello
sqlite> select * from t2;    
2|hello
4|hello
sqlite> 

本文系转载,前往查看

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

本文系转载前往查看

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 附加数据库
相关产品与服务
数据库
云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档