Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - The meaning of various data types of sql
The meaning of various data types of sql
The data type of Bit Integer bit is an integer, and its value can only be 0, 1 or null. This data type is used to store data with only two possible values, such as Yes or No, True or Fa lse, On or Offint. Int data type can store integers ranging from -23 1(-2 147483648) to 23 1 (2 147483 647). This data type can be used for almost all numerical data stored in the database. This data type occupies 4 bytes in the database. The smallint integer smallint data type can store integers from -2 15(-32768) to 2 15(32767). This data type is very useful for storing some digital data that is usually limited to a specific range. This data type occupies 2 bytes in the database. Tinyint integer tinyint data type can store integers from 0 to 255. This is useful when you only want to store a limited number of values. This data type occupies 1 byte in the database. Numeric precision numeric data type is the same as decimal precision numeric data type. Decimal exact numeric data type can be used to store digital data with fixed precision, ranging from-1038- 1 to 1038- 1. When using this data type, you must specify the range and precision. This range is the total number of digits that can be stored around the decimal point. Precision is the number of digits stored to the right of the decimal point. Currency Currency data type is used to represent currency and currency value. This data type can store data from-922 billion to 922 billion, accurate to one tenth of the monetary unit. The currency type smallmoney data type is used to represent currency and currency values. This data type can store data from -2 14748.3648 to 2 14748.3647. The float data type is an approximate value type, accurate to one ten thousandth of the monetary unit and used by floating-point numbers. Floating-point numbers are approximate because not all numbers within their range can be accurately represented. The floating point number can be any number from-1.79E+308 to 1.79E+308. Real data type is similar to floating point number and is an approximate type. It can represent the floating-point datetime data type with a value between -3.40E+38 and 3.40E+38, which is used to represent the date and time. This data type stores all date and time data from 1753 65438+ 10/to nine thousand nine hundred and ninety-nine 65438+February 3rd 1. The Smalldatetime data type accurate to one hundredth of a second or 3.33 milliseconds is used to represent the date and time from 19065438+ 10/0 to June 6, 2079. Cursor special data type Cursor data type is a special data type, which contains references to cursors. This data type is used for stored procedures, and timestamps cannot be used when creating tables. The timestamp data type is a special data type used to create unique numbers in the database. There can only be one timestamp column in a table. Every time a row is inserted or modified, the value of the timestamp column changes. Although it has "time" in its name, the timestamp column is not a date that people can recognize. In the database, the timestamp value is a unique identifier. The Uniqueidentifier data type is used to store globally unique identifier, that is, GUID. GUID is truly unique in the world. There is little chance that this number will be reconstructed in another system. You can use the NEWID function or convert a string into a unique identifier to initialize the column char character char data type with a unique identifier, which is used to store fixed-length non-uniformly encoded data of a specified length. When defining a column as this type, you must specify the column length. This data type is useful when you always know the length of the data to be stored. For example, when you store data by postal code plus four characters, you know that 10 characters are always used. The maximum column width of this data type is 8000 characters. The varchar data type is a varchar character type, which, like the char type, is used to store non-uniformly encoded character data. Unlike char, this data type is variable in length. When defining a column as a data type, you should specify the maximum length of the column. The biggest difference between it and char data type is that the length of storage is not the length of column, but the length of data. Text data type is used to store a large number of non-uniformly coded character data. This data type can have up to 23 1- 1 or 2 billion characters. The nchar data type is used to store nchar data of fixed length. Unicode uses a double-byte structure to store each character instead of a single byte (as is the case with ordinary text). It allows a large number of extended characters. This data type can store 4000 characters and double the byte space used. The nvarchar data type is used as variable-length unicode character data. This data type can store 4000 characters and double the byte space used. Ntext Unicode Character ntext data type is used to store a large number of Unicode character data. This data type can store 230-1 or nearly 1 100 million characters, and the byte space used is doubled. The binary data type is used to store fixed-length binary data up to 8000 bytes. When the contents of the input table are close to the same length, this data type varbinary data type varbinary data type should be used to store variable-length binary data with a maximum length of 8000 bytes. When the content size of the input table is variable, you should use this data type image binary data type image data type to store binary data with variable length, and the maximum length can reach 23 1- 1 or about 2 billion bytes.