What really happens when I use varchar(10) in the sqlite command-line shell?
        Posted  
        
            by romandas
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by romandas
        
        
        
        Published on 2010-04-22T22:01:12Z
        Indexed on 
            2010/04/22
            22:03 UTC
        
        
        Read the original article
        Hit count: 561
        
I'm messing around with SQLite for the first time by working through some of the SQLite documentation. In particular, I'm using Command Line Shell For SQLite and the SoupToNuts SQLite Tutorial on Sourceforge.
According to the SQLite datatype documentation, there are only 5 datatypes in SQLite. However, in the two tutorial documents above, I see where the authors use commands such as create table tbl1(one varchar(10), two smallint); or create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE); which contain datatypes that aren't listed by SQLite, yet these commands work just fine.
Additionally, when I ran .dump to see the SQL statements, these datatype specifications are preserved.
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?
© Stack Overflow or respective owner