MYSQL Tutorial: MYSQL data value type (datatype) _ MySQL

Source: Internet
Author: User
MYSQL Tutorial: MYSQL data value type (datatype) tip: MySQL data value classification, including numeric, numeric, date, and null, which is similar to the general programming language classification.


MySQL databases are composed of data. to facilitate the management and use of the data, we classify the data to form various data types with data values, there are data column types in the table and data table types. Understanding these data types of MySQL makes it easier for us to use MySQL databases. Next we will give a brief introduction to various data types.

1.1. data type)
The classification of MySQL data values includes numeric, numeric, date, and null values, which is similar to that of general programming languages.

1.1.1. value
MySQL has two types of values: integer and floating point. MySQL supports scientific notation. An integer can be in decimal or hexadecimal format.

1.1.2. string
MySQL supports character sequences enclosed by single or double quotation marks. For example, "MySQL tutorial" and "Mysql Database '.

MySQL can recognize escape sequences in strings. escape sequences are expressed by backslash. The following is a list of escape sequences.

Table 1.1. escape sequence

Meaning of escape sequence
/0 NUL (ASCII 0 value)
/'Single quotes
/"Double quotation marks
/B backlash
/N linefeed
/R carriage return
/T tab
// Backslash
/Z Ctrl + Z

If the string itself contains a single double quotation mark, one of the following three methods is used:

If the quotation marks of a string are the same as those of a string, double quotation marks are used. For example, 'MySQL's test '.

The string is enclosed by different quotation marks, such as "mysql's test ".

Escape the quotation marks with a backslash, for example, "mysql/'test", 'MySQL/'test '. In this way, the single quotation marks or double quotation marks at both ends of the string are ignored.

A string can be expressed by a hexadecimal number. for example, 0x61 represents the character "". The string value can also be expressed by 'Val' in ansi SQL notation starting from MySQL 4.0. For example, '61 'indicates the character "".

From MySQL 4.1, you can specify a character set for the string value.

1.1.3. date and time
By default, MySQL displays the date in the order of "year-month-day.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.