SQLite Data Types

SQLite is a language embedded into some relational database management systems that you can use to query databases using SQL syntax. You can assign these data types to fields in tables or create variables to use in queries. However, unlike some other programming and query languages, most major implementations of SQLite have a limited number of types.

  1. Integer

    • An integer data type stores whole numbers. It saves signed numbers, so you can use both positive and negative values. Unlike some programming languages in which you specify different integer types based on the range of numeric values you need, SQLite only has the one integer type and uses a different number of bytes for storage of integer types, depending on the size of the value you save in the field, up to eight bytes.

    Real

    • The real data type stores both whole numbers or floating point numbers. Like integers, you can use positive or negative values. Unlike integers though, real types always use eight bytes for storage in memory because SQLite reserves space for digits on both sides of a decimal place, even if you assign a small number to the field or a number that does not have a fraction. If you use "floating point" to declare a real type field, SQLite will use the integer type due to the "int" at the end of "point."

    Text

    • The text data type stores strings or characters into a field using UTF encoding. You can specify a maximum number of characters that a text field can hold when you create the database. The amount of storage in memory that a text type needs depends on how many characters you insert into the field. You can use comparison operators including the equals sign, greater than or less than, or keywords such as "IN", "BETWEEN" and "IS" to compare text types.

    BLOB

    • The BLOB data type stores data of any type into fields exactly as you enter it, and it stands for binary large object. This type can also hold other types of data such as images or multimedia files. SQLite never attempts to convert BLOB values to other types. You can compare two BLOB types using a memory comparison function. When you sort fields of various data types, BLOB fields take precedence over all of the other types.

Related Searches

References

Related Ads

View Mobile Site