从 SQLite 命令行 shell 中打开数据库文件 [英] Opening database file from within SQLite command-line shell

查看:28
本文介绍了从 SQLite 命令行 shell 中打开数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 SQLite 命令行外壳.如文档所述,我可以通过将数据库作为参数提供给可执行文件来打开数据库:

I'm using the SQLite Command Line Shell. As documented, I can open a database by supplying it as an argument to the executable:

sqlite3 data.db

在没有提供文件作为命令行参数的情况下调用数据库文件后,我无法弄清楚如何从工具内打开它(如果我双击 sqlite3.exe在 Windows 中).

I cannot figure out how to open a database file from within the tool after having invoked it without supplying the file as a command-line argument (if I, say, double-click sqlite3.exe in Windows).

SQLite shell 工具中指定数据库文件的命令是什么?

推荐答案

您可以附加一个甚至多个数据库,并像使用 sqlite dbname.db 一样使用它

You can attach one and even more databases and work with it in the same way like using sqlite dbname.db

sqlite3
:
sqlite> attach "mydb.sqlite" as db1;

你可以看到所有附加的数据库.数据库

and u can see all attached databases with .databases

在正常情况下,main 用于命令行 db

where in normal way the main is used for the command-line db

.databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main                                                                       
1    temp                                                                       
2    ttt              c:\home\user\gg.ite                                   

这篇关于从 SQLite 命令行 shell 中打开数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆