(1) character type: varchar and char
Both data types are used to store strings of less than 255 characters, with slight differences between them. 1. varchar stores fixed-length strings, and the number of characters in the input is changed. When char stores fixed-length strings, it is filled with spaces when there are not enough digits. 2varchar saves more space than char.
Assume that you enter the data Bill Gates in a 40-character varchar field. When you extract this data from this field, the length of the data you extract is 10 characters-the length of the string Bill Gates. Now, if you input a string into a char field with a length of 40 characters, the length of the retrieved data will be 40 characters. Extra spaces will be appended to the string.
(2) text type: Text
Text is text-type data. When you need to store large strings, you can choose text, which can store strings with more than 2 billion characters. The text data type has no length. Its fields are either large or empty.
(3) numeric type: integer int, decimal numeric, and money
Numeric: This data type can be used to control data. You can use it to simultaneously represent the integer and decimal parts of a number. Numeric data enables you to represent a very large number-much larger than int data. A numeric field can be stored in the range of + from-1038 to + 1038. Numeric data also enables you to represent the number of fractional parts. For example, you can store in a numeric field. When defining a numric field, you must specify the size of the integer part and the decimal part at the same time. For example, numeric (). The integer part of a numeric data can only have a maximum of 28 digits. the digits in the decimal part must be smaller than or equal to the digits in the integer part, and the decimal part can be zero.
This data type is also a commonly used data type for Data Center billing systems. I believe everyone is familiar with it.
(4) logical bit
If you use the check box to collect information from a webpage, you can store this information in the bit field. A bit field can have only two values: 0 or 1. However, after you create a table, you cannot add a bit field to the table. If you want to include a bit field in a table, you must complete it when creating the table.
(5) datetime and smalldatetime
A datetime field can store the date range from the first millisecond of January 1, January 1, 1753 to the last millisecond of January 1, December 31, 9999. If you do not need to cover such a large range of dates and times, you can use smalldatetime data. It is used in the same way as datetime data, except that it can represent a smaller date and time range than datetime data, and is not as precise as datetime data. A smalldatetime field can store dates from January 1, January 1-20, 1900 to January 1, June 6. It can only be accurate to seconds.
Datetime fields do not contain actual data before you enter the date and time. It is important to understand this.