Reputation: 13367
I don't understand why this query (that is not correct) does not raise any error:
CREATE TABLE test (
ID,
VARIANT riri fifi lili,
PRIMARY KEY(ID, VARIANT ASC))
Also is their any difference from:
VARIANT TINYINT
VARIANT INTEGER
VARIANT BIGINT
VARIANT UNSIGNED INTEGER
Upvotes: 0
Views: 71
Reputation: 56948
SQLite has a restricted set of column types (column affinity) (TEXT, NUMERIC, INTEGER, REAL and BLOB). However, it will accept virtually anything as a column type (see How Flexible/Restrictive are SQLite column Types below) and convert this according to a set of rules to one of the restricted set of column types:-
So riri fifi lili
will have a column type of NUMERIC (drops through to the last rule).
TINYINT
, INTEGER
, BIGINT
, UNSIGNED INTEGER
will all have a column type of INTEGER (as they all contain INT and meet the 1st rule).
CHARINT
will have a column type if INTEGER (it meets the 1st rule).
Saying that a column can in fact contain any type, although the column's type (affinity) can have subtle nuances when retrieving data (see Datatypes in SQLite3 below). Note an exception to this is a column that is an alias of rowid.
A more comprehensive answer can be found here How flexible/restricive are SQLite column types?
You may also wish to check out Datatypes In SQLite Version 3
Upvotes: 2