Static data types are generally fixed data used, and SQLite uses dynamic data type is automatically determined according to the value stored. 
SQLite following five data types: 
1.NULL: null. 
2.INTEGER: unsigned integer, depending of the size range have stored numbers. 
3.REAL: floating point numbers, are stored as 8-byte IEEE floating-point number. 
4.TEXT: text string. 
5.BLOB: binary object. 


But in fact, sqlite3 accept the following data types: 
integer smallint 16-bit. 
integer 32-bit integer. 
decimal integer (p, s) decimal values of p and s exact size, the exact value p refers to the total number of a few (digits) size value, s 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. 
double 64-bit real number. 
string (n) n is the length of char, n not exceed 254. 
varchar (n) and the maximum length is fixed length n string n, n not exceed 4000. 
graphic (n) and char (n) as two characters but the unit is double-bytes, n is not more than 127. To support this form is the length of two characters in the font, such as text. 
VARGRAPHIC (n) variable length and the maximum length of the dual character string n, n can not exceed 2000 
DATE comprising year, month, date. 
comprising the time in hours, minutes, seconds. 
timestamp contains the year, month, day, hour, minute, second, thousandths of a second. 

datetime contains the date and time format, must be written as '2010-08-05' can not be written as '2010-8-5', otherwise it will generate an error when reading! 

Sqlite common data types, 

the phrase itself is a problem, because:. SQLite is untyped This means that you can store any type of data to any column of any table you want to save, whether this column declared What type of data is (only auto-increment Integer Primary Key to be useful) for SQLite is on the field does not specify the type to be completely effective, such as..: 

Sql Code 
 
  Collection Code
  1. Create Table ex3(a, b, c);  



Even allows you to override SQLite data types, it is recommended that you specify a data type in the Create Table statement because the data types for you and other programmers exchange, or are you going to replace your database engine is very useful. SQLite support common data types, such as: 

Sql Code 
 
  Collection Code
  1. CREATE TABLE IF NOT EXISTS ex2(      
  2. VARCHAR(10),      
  3. b NVARCHAR(15),     
  4. c TEXT,      
  5. INTEGER,     
  6. FLOAT,     
  7. f BOOLEAN,      
  8. g CLOB,      
  9. h BLOB,      
  10. TIMESTAMP,     
  11. NUMERIC(10,5),      
  12. VARYING CHARACTER (24),      
  13. NATIONAL VARYING CHARACTER(16)     
  14. );  


distinction char, varchar, text and nchar, nvarchar, ntext of 

1, CHAR. CHAR fixed-length data storage is convenient, high efficiency index on CHAR field level, such as the definition char (10), then regardless of your data storage has reached 10 bytes, it must take up 10 bytes of space, inadequate the auto-fill with spaces. 

2, VARCHAR. Storing variable-length data, but not CHAR high storage efficiency. If the value of a field may not be a fixed length, we only know that it can not be more than 10 characters, it is defined as VARCHAR (10) is the best buy. The actual length of VARCHAR type is its actual length value +1. Why "+1" mean? This is a byte used to store how much the actual length. From space considerations, a suitable use varchar; from the viewpoint of efficiency, with a suitable char, the key is to find the trade-off is the actual situation. 

3, TEXT. Unicode text data stored in the non-variable length, the maximum length of 2 ^ 31-1 (2,147,483,647) characters. 

4, NCHAR, NVARCHAR, NTEXT. Judging from the name of these three three kinds of more than a "N" than the previous. It represents the type of data storage is Unicode character. We know the characters, English characters only need one byte memory is sufficient, but many Chinese characters, require two bytes of storage, is likely to cause confusion when English and Chinese characters exist, Unicode character set the character set is to solve this incompatibility the problems that arise, with all its characters are two bytes, ie the English characters is represented by two bytes. length nchar, nvarchar is between 1 and 4000. And char, varchar comparison, nchar, nvarchar then store up to 4000 characters, whether English or Chinese characters; and char, varchar can store up to 8,000 English, 4,000 Chinese characters. It can be seen using the nchar, nvarchar data types do not worry when character input is English or Chinese characters, more convenient, but when some of the English memory loss amount.  

    So generally we have Chinese characters, with nchar / nvarchar, if plain English and digital, with char / varchar.

Please indicate the source of the purpose of writing blog: recording, sublimation, quantitative to qualitative change