易截截图软件、单文件、免安装、纯绿色、仅160KB

SQLITE入门 逐步讲解SQLITE命令行(六)


.nullvalue STRING 用STRING代替null值显示,不难理解,就不再累述了。
.output FILENAME 设置把查询输出到文件,后面的输出结果都保存到文件中,如:
sqlite> .mode list
sqlite> .output websites.txt
sqlite> select * from websites;
sqlite>
可以在F盘下发现建立了websites.txt文件,其内容如下:
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
5|技术
.output stdout 设置把查询结果输出到屏幕,这是默认输出方式。如:
sqlite> .output stdout
sqlite> select * from websites;
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
5|技术
sqlite>
.prompt MAIN CONTINUE Replace the standard prompts(修改提示符)请补充?
.quit 退出SQLite程序,同.exit命令
.read FILENAME Execute SQL in FILENAME 执行文件中的SQL语句,文件中的语句一定要带上分号(;).
我们在F盘下建sqldata.txt文件,其内容为:
insert into websites(WebName) values('测试插入数据0');
insert into websites(WebName) values('测试插入数据1');
select * from websites;
我们执行.read命令如下:
sqlite> .read sqldata.txt
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
5|技术
6|测试插入数据0
7|测试插入数据1
sqlite>
.schema ?TABLE? Show the Create statements 以SQL格式输出表结构,如:
sqlite> .schema websites
CREATE TABLE [websites] (
[WebID] INTEGER NOT NULL PRIMARY KEY,
[WebName] VARCHAR(20) NULL
);
CREATE INDEX mytestindex on websites([webID]);
sqlite>
.separator STRING Change separator used by output mode and .import 修改分隔符,如:
sqlite> select * from websites limit 4;
1|CTOChina.net
2|搜狐
3|雅虎
4|开源
sqlite> .separator /
sqlite> select * from websites limit 4;
1/CTOChina.net
2/搜狐
3/雅虎
4/开源
sqlite>
.show Show the current values for various settings 显示配置信息,如:
sqlite> .show
echo: off
explain: off
headers: off
mode: list
nullvalue: ""
output: stdout
separator: "/"
width:
sqlite>
.tables ?PATTERN? List names of tables matching a LIKE pattern 显示库中表的列表。
.timeout MS Try opening locked tables for MS milliseconds 超时时间,单位:毫秒
.width NUM NUM ... Set c


相关文档:

sqlite的安装

使用版本:sqlite-3.6.14.2
下载地址:http://www.sqlite.org/sqlite-3.6.14.2.tar.gz
首先参考readme的提示:

    tar xzf sqlite.tar.gz    ;#  Unpack the source tree into "sqlite"
    mkdir bld      &nbs ......

关于SQLite 转帖


最近在项目中用到了SQLite。主要是客户端用到,这种小型内嵌数据库还是蛮实用的。
提起SQLite我不自觉的就想起了微软出的ACCESS。他们两个确实是有可比性的。曾经,小型网站数据库,ASP可以用到ACCESS。但是,PHP却是没有相对应的解决方案,自从SQLite的出现,给PHP提供了一个解决方案。
在客户端里面,我用到的数据保 ......

Sqlite实现默认时间为当前时间列的方法

    在SQL Server中,创建表格的时候,对于时间列有时候我们可以根据需要指定默认值为当前时间(也就是说记录生成的时候有默认的时间戳)。例如:
    create table log(
content varchar(256),
logtime datetime default getdate()
)
  
    然 ......

SQLITE入门 逐步讲解SQLITE命令行(二)

可以接着上一步操作,直接向DOS窗口输入.help命令来查看SQLite的所有命令行及解释如下:
F:\>sqlite3
SQLite version 3.6.16
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .help
也可以ctrl+c结束命令,想DOS窗口 输入sqlite3执行后再输入.help命令如下:
F:\>sqli ......

SQLITE入门 逐步讲解SQLITE命令行(四)

.dump ?TABLE? ... 以SQL语句方式显示表的结构。如:
sqlite> .dump websties
BEGIN TRANSACTION;
COMMIT;
sqlite> .dump websites
BEGIN TRANSACTION;
CREATE TABLE [websites] (
[WebID] INTEGER NOT NULL PRIMARY KEY,
[WebName] VARCHAR(20) NULL
);
INSERT INTO "websites" VALUES(1,'CTOChina.net'); ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号