MySQL data type

xiaoxiao2021-03-06  54

MySQL data type

Depending on the definition, the purpose of the database management system is to manage data. Even a simple SELECT 1 statement also involves an expression request value to generate a integer data value. Each data value in MySQL has a type. For example, 37.4 is a number, and "A B C" is a string. Sometimes, the type of data is obvious because the type of each column defined as a table is specified when using the CREATE TABLE statement, such as: and sometimes, data type is unclear, such as referenced in an expression Direct value, send values ​​to a function, or use the value returned from the function, such as: INSERT statement completes the following operations, all of which involve data type: ■ Assign the integer value 14 to integer column INT _ col. ■ Transfer string values ​​"a" and "b" to function C O N c at (). C O N c AT () returns string value "a b", which is given the string S T R _ C O L. ■ Assign an integer value 1999 0 115 to the date column DATE _ C O L. And this does not match, so Mysql will automatically perform data type conversion. To effectively use MySQL, you must understand how it processes data. This chapter describes the data types that MySQL can handle and discuss issues that occur when handling these data types, the main contents are as follows: ■ Universal data type, including NULL values. ■ Special data types, and the properties of each column type. Some column types are quite common, such as the CHAR string type. And some of the type of Auto_InCrement integer and T i m e s Tamp, which is very special, should be understood to avoid errors. ■ The column type of properly selects the table. When you create a table, it is important to understand how to choose the best type for your own purpose, and select a type when you can use to store the value. ■ Expressive evaluation rules. MySQL provides many operators and functions that can be used for expressions in order to retrieve, display, and process data. The rules of the expression evaluation include type conversion rules, which require type conversion rules when a type of value is used for another type of value. It is important to understand when to perform type conversion and how to convert; some conversion is meaningless and the error value is generated. The string "13" is assigned to an integer column result is 13, but the string "A B C" is assigned to the column to obtain 0 value because "a b c" is not a number. Moreover, if the conversion of the decapital value can be compared, it may bring a big danger. If you intend to operate only a few lines, you may update or delete all the rows in the table. Appendix B and Appendix C provide more information on mysql column types, operations, and functions. 2.1Mysql data type MySQL has several data types, which are described below. 1. Numerical value is a value such as 48 or 193.62. MySQL supports the value of an integer (no fractional portion) or floating point number (with a fractional portion). Integers can be expressed in decimal form or hexadecimal form. Integer consists of a digital sequence. The integer represented by hexadecimal form is composed of one or more hexadecimal numbers ("0" to "9" and "A" to "F") by "0 x". For example, 0x0a is a decimal 10, while 0 x ffff is a decimal 6 5 5 3 5. Hexadecimal numbers are not case sensitive, but their prefix "0 x" cannot be "0 x". That is, 0x0a and 0x0a are legal, but 0x0a and 0x0a are not legal. The floating point is composed of a Arabic digital sequence, a decimal point and another arabic digital sequence. The two Arabic digital sequences can be empty, but they cannot be empty. MySQL supports scientific representation.

转载请注明原文地址:https://www.9cbs.com/read-81397.html

New Post(0)