【发布时间】:2011-02-11 07:08:17
【问题描述】:
通过阅读一些 SQLite 文档,我第一次使用 SQLite。特别是,我在 Sourceforge 上使用 Command Line Shell For SQLite 和 SoupToNuts SQLite Tutorial。
根据 SQLitedatatype documentation,SQLite 中只有 5 种数据类型。但是,在上面的两个教程文档中,我看到了作者在哪里使用了诸如
之类的命令create table tbl1(one varchar(10), two smallint);
create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE);
其中包含 SQLite 未列出的数据类型,但这些命令可以正常工作。
此外,当我运行 .dump 查看 SQL 语句时,这些数据类型规范被保留:
sqlite> CREATE TABLE Vulnerabilities (
...> VulnerabilityID unsigned smallint primary key,
...> VulnerabilityName varchar(10),
...> VulnerabilityDescription longtext);
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE Vulnerabilities (
VulnerabilityID unsigned smallint primary key,
VulnerabilityName varchar(10),
VulnerabilityDescription longtext);
COMMIT;
sqlite>
那么,什么给了? SQLite 是否保留 SQL 中指定的任何数据类型的引用,但在幕后将其转换为其 5 种数据类型之一?还是我还缺少其他东西?
【问题讨论】: