当前位置:数据库 > SQLite >>

在 linux shell下使用 sqlite3疑问

在 linux shell下使用 sqlite3 命令如下: [root@localhost root]# sqlite3 SQLite version 3.5.6 Enter ".help" for instructions sqlite> attach 'cc.db' as cc ...> ; sqlite> create table a(id int primary key ); sqlite> .tables a sqlite> .quit [root@localhost root]# 退出以后 用同样的方法进入, .tables一下 发现 刚才创建的表消失了,没有任何表,请问这是什么原因?
答案:sqlite3 命令后面要指定数据库文件的名字,若没指定会创建内存数据库;
但内存数据库在命令退出后完成使命而消失,不保存任何内容在磁盘。 

tim@tim-Vostro-200:~$ sqlite3 test.db
sqlite> create table  a(id int primary key );
sqlite> .tables
a
sqlite> .quit
tim@tim-Vostro-200:~$ sqlite3 test.db
sqlite> .tables
a
sqlite> .quit
tim@tim-Vostro-200:~$ sqlite3
sqlite> attach 'test.db' as cc;
sqlite> create table  cc.b(id int primary key );
sqlite> .quit
tim@tim-Vostro-200:~$ sqlite3 test.db
sqlite> .tables
a  b
sqlite> .quit
$

上一个:C语言访问SQLite数据库报错
下一个:在sqlite中怎么返回到上一步?

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,