Data Types supported by SQLite

Source: Internet
Author: User

I had to learn mysql for a month in my last job, and soon I forgot a lot of things. Now I want to learn more about sqlite because of my work,Data Types supported by Sqlite3

NULL,INTEGER,REAL,TEXT,BLOB

And:
Smallint is an integer of 16 bits.
An integer of 32-bit interger.
Decimal (p, s) p exact value and the decimal integer of s size. Exact value p refers to the number of digits after the decimal point. If not specified, the system is set to p = 5; s = 0.
Float 32-bit real number.
The real number of the double 64-bit element.
Char (n) n length string, n cannot exceed 254.
A string with an unfixed varchar (n) length and a maximum length of n. n cannot exceed 4000.
Graphic (n) is the same as char (n), but it is measured in double-bytes. n cannot exceed 127. This form supports two character-length fonts, such as Chinese characters.
A dual-character string with a variable vargraphic (n) length and a maximum length of n. n cannot exceed 2000
Date contains the year, month, and date.
Time contains hours, minutes, and seconds.

Timestamp includes year, month, day, hour, minute, second, And 1‰ seconds.

Table 1-1

Type Description
TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, BYTEA String types of unlimited length. Binary data must be safely encoded, see text.
CHAR (), VARCHAR (), TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT String types of unlimited length. There is no chopping or padding stored med by the database engine.
ENUM String type of unlimited length. In contrast to MySQL, choosing ENUM over VARCHAR does not save any storage space.
SET String type of unlimited length. In contrast to MySQL, the input is not checked against the list of allowed values.
YEAR String type of unlimited length. MySQL stores 2 or 4 digit years as a 1 byte value, whereas the SQLite drivers stores the string as provided.
TINYINT, INT1, CHAR A 1 byte type used to store one character, a signed integer between-128 and 127, or an unsigned integer between 0 and 255.
SMALLINT, INT2 2 byte (short) integer type used to store a signed integer between-32768 and 32767 or an unsigned integer between 0 and 65535.
MEDIUMINT 3 byte integer type used to store a signed integer between-8388608 and 8388607 or an unsigned integer between 0 and 16777215.
INT, INTEGER, INT4 4 byte (long) integer type used to store a signed integer between-2147483648 and 2147483647 or an unsigned integer between 0 and 4294967295.
BIGINT, INT8, INTEGER PRIMARY KEY 8 byte (long) integer type used to store a signed integer between-9223372036854775808 and 9223372036854775807 or an unsigned integer between 0 and 18446744073709551615. See below for a discussion of integer primary key.
DECIMAL, NUMERIC A string type of unlimited length used to store floating-point numbers of arbitrary precision.
TIMESTAMP, DATETIME A string type of unlimited length used to store date/time combinations. The required format is 'yyyy-MM-DD HH: MM: ss', anything following this pattern is ignored.
DATE A string type of unlimited length used to store a date. The required format is 'yyyy-MM-DD ', anything following this pattern is ignored.
TIME A string type of unlimited length used to store a time. The required format is 'hh: MM: ss', anything following this pattern is ignored.
FLOAT, FLOAT4, REAL A 4 byte floating-point number. the range is-3.402823466E + 38 to-1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E + 38. please note that MySQL treats REAL as an 8 byte instead of a 4 byte float like PostgreSQL.
DOUBLE, double precision, FLOAT8 An 8 byte floating-point number. The range is-1.7976931348623157E + 308 to-2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to bytes + 308.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.