sqlite3 columns types

前端 未结 1 436
清歌不尽
清歌不尽 2021-01-24 04:19

I\'m starting a new project that has to convert data from XML to db. XMLs have their own format and cannot be used to fill a db

相关标签:
1条回答
  • 2021-01-24 05:12

    SQLite uses dynamic typing.

    To check data types, use CHECK constraints:

    CREATE TABLE Table2(
        ID          INTEGER  PRIMARY KEY,
        TABLE_1_ID  INT      FOREIGN KEY REFERENCES Table1(ID) NOT NULL,
        COLUMN_1    INT[512] NOT NULL
        COLUMN_2    TEXT     NOT NULL   CHECK (typeof(COLUMN_2) = 'text'),
        COLUMN_3    BOOLEAN  DEFAULT 0  CHECK (COLUMN_3 IN (0, 1))
    );
    
    0 讨论(0)
提交回复
热议问题