SQLite information type is a quality that indicates the kind of information of any article. Every section, variable and articulation has related information type in SQLite.
You would utilize these information types while making your tables. SQLite utilizes a more broad powerful sort framework. In SQLite, the datatype of a worth is related with the actual worth, not with its holder.
SQLite Storage Classes
Each worth put away in a SQLite data set has one of the accompanying stockpiling classes −
Sr.No. | Storage Class & Description |
---|---|
1 |
NULL The value is a NULL value. |
2 |
INTEGER The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value. |
3 |
REAL The value is a floating point value, stored as an 8-byte IEEE floating point number. |
4 |
TEXT The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16LE) |
5 |
BLOB The value is a blob of data, stored exactly as it was input. |
SQLite stockpiling class is marginally more broad than a datatype. The INTEGER stockpiling class, for instance, incorporates 6 diverse whole number datatypes of various lengths.
SQLite Affinity Type
SQLite upholds the idea of type liking on sections. Any segment can in any case store any kind of information yet the favored stockpiling class for a section is called its proclivity. Each table segment in a SQLite3 data set is allocated one of the accompanying kind affinities −
Sr.No. | Affinity & Description |
---|---|
1 |
TEXT This column stores all data using storage classes NULL, TEXT or BLOB. |
2 |
NUMERIC This column may contain values using all five storage classes. |
3 |
INTEGER Behaves the same as a column with NUMERIC affinity, with an exception in a CAST expression. |
4 |
REAL Behaves like a column with NUMERIC affinity except that it forces integer values into floating point representation. |
5 |
NONE A column with affinity NONE does not prefer one storage class over another and no attempt is made to coerce data from one storage class into another. |
SQLite Affinity and Type Names
Following table records down different information type names which can be utilized while making SQLite3 tables with the relating applied proclivity.
Data Type | Affinity |
---|---|
|
INTEGER |
|
TEXT |
|
NONE |
|
REAL |
|
NUMERIC |
Boolean Datatype
SQLite doesn't have a different Boolean stockpiling class. All things being equal, Boolean qualities are put away as whole numbers 0 (bogus) and 1 (valid).
Date and Time Datatype
SQLite doesn't have a different stockpiling class for putting away dates and additionally times, yet SQLite is fit for putting away dates and times as TEXT, REAL or INTEGER esteems.
Sr.No. | Storage Class & Date Formate |
---|---|
1 |
TEXT A date in a format like "YYYY-MM-DD HH:MM:SS.SSS" |
2 |
REAL The number of days since noon in Greenwich on November 24, 4714 B.C. |
3 |
INTEGER The number of seconds since 1970-01-01 00:00:00 UTC |
You can decide to store dates and times in any of these organizations and unreservedly convert between designs utilizing the inherent date and time capacities.