Home » Blog » Topic » SQLite and Integer types (int, integer, bigint)

SQLite and Integer types (int, integer, bigint)

Stephen West ~ Modified: August 18th, 2015 ~ ~ 1 Minute Reading

Home Forums SQLite and Integer types (int, integer, bigint)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #483 Score: 0
    Stephen West
    Moderator
    4 pts

    What is the difference between integer data types in SQLite ?

    INT
    INTEGER
    TINYINT
    SMALLINT
    MEDIUMINT
    BIGINT
    UNSIGNED BIG INT
    INT2
    INT8

    which one can store 32 bit integers and which one can store 64 bit values ? is  there any support for 128 bit ?

    I find integer data size a little confusing for now, INTEGER for example can store up to 64-bit signed integers, but values may occupy only 32 bits on disk.

    calling sqlite3_column_int on a INTEGER column will work only if the value stored is less that int32 max value ? How will behave if higher ?

    #486 Score: 0
    Lincoln Burrows
    Moderator
    16 pts

    SQLite uses a more general dynamic type system. In SQLite, the datatype of a value is associated with the value itself, not with its container. The dynamic type system of SQLite is backwards compatible with the more common static type systems of other database engines in the sense that SQL statement that work on statically typed databases should work the same way in SQLite. However, the dynamic typing in SQLite allows it to do things which are not possible in traditional rigidly typed databases.
    So in MS Sql Server (for example), an “int” == “integer” == 4 bytes/32 bits.

    In contrast, a SqlLite “integer” can hold whatever you put into it: from a 1-byte char to an 8-byte long long.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.