Data type of database: integer: Int,smallint,bigint,decimal real type: float,real. String type:Char/nchar,Varchar/nvarchar. 1. There is no difference between VAR: a variable-length string type with Var, and a fixed length string without var. Fixed-Length field, if the stored data does not reach the maximum length, the system will fill the string behind the input space. When the recorded data has a fixed length, the selected length (Char/nchar) is used. When it is not possible to determine how long the recorded data is, choose a variable length (varchar/nchar) fixed length: It is easy to waste storage space, but the query efficiency is high. Variable length: Saves storage space, but query efficiency is low. 2. N Difference: Data type data with n is Unicode encoded, without n is non-Unicode encoding. Unicode uses 2 bytes to store 1 characters. Use with n : When this field needs to store more Chinese characters, be sure to use N. These 4 data types must be set to its maximum length in use: nvarchar (12), "can store 12 Chinese characters and or 12 English letters" char (12) "can store 6 Chinese characters and 12 English letters". Maximum Length: Char/varchar (8000), Nchar/nvarchar (4000) 3 Text/ntext is used to store oversize text. Image type: image, in binary form, the picture is stored in the database file (infrequently used). Generally, the picture is stored as a file string on the server, the database only stores the path of the picture. Only when the security requirements of the picture is particularly high, the image will be stored directly in the database.
On the differences and usage of string types in database