Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat really happens when I use varchar(10) in the sqlite command-line shell?
    primarykey
    data
    text
    <p>I'm messing around with SQLite for the first time by working through some of the SQLite documentation. In particular, I'm using <a href="http://sqlite.org/sqlite.html" rel="nofollow noreferrer">Command Line Shell For SQLite</a> and the SoupToNuts <a href="http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html" rel="nofollow noreferrer">SQLite Tutorial</a> on Sourceforge.</p> <p>According to the SQLite <a href="http://www.sqlite.org/datatype3.html" rel="nofollow noreferrer">datatype documentation</a>, there are only 5 datatypes in SQLite. However, in the two tutorial documents above, I see where the authors use commands such as</p> <pre><code>create table tbl1(one varchar(10), two smallint); create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE); </code></pre> <p>which contain datatypes that aren't listed by SQLite, yet these commands work just fine.</p> <p>Additionally, when I ran .dump to see the SQL statements, these datatype specifications are preserved:</p> <pre><code>sqlite&gt; CREATE TABLE Vulnerabilities ( ...&gt; VulnerabilityID unsigned smallint primary key, ...&gt; VulnerabilityName varchar(10), ...&gt; VulnerabilityDescription longtext); sqlite&gt; .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE Vulnerabilities ( VulnerabilityID unsigned smallint primary key, VulnerabilityName varchar(10), VulnerabilityDescription longtext); COMMIT; sqlite&gt; </code></pre> <p>So, what gives? Does SQLite keep a reference for any datatype specified in the SQL yet converts it behind the scenes to one of its 5 datatypes? Or is there something else I'm missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload