MySQL database learning-5. Data Types, character sets, and Proofreading

Source: Internet
Author: User

1. Value Type

2, string type 3, date and time 4, Enum and set5, ry data type option unsigned no negative zerofill value display has an effect, auto_increment serial default value = declare auto_increment not null tinyint-128 ---- 127 smallint-32768 ---- 32767 mediumint-8388608 ----- 8388607int (integer) -2147483648 ---- 2147483647 bigint-numeric floating point float 4 bytes plus and minus 1.175494351e-38 ----- plus and minus 3.402823466e + 38 double 8 bytes plus and minus 2.225074255072014e-308 --- plus and minus + 308 Fixed Points decdecdecimalbit

 

Char 0-255varchar 0-65535 tinyblob 0-255blob 0-65535mediumblob between 0-4294967295 tinytext 0-255text 0-65535mediumtext between 0-4294967295 binary characters, only binary characters varbinary 0-mbinary 0-m Date 1000-01-01----9999-12-31 datetime 1000-01-01-00:00:00 ---- 9999-12-31 23: 59: 59 time-838: 59: 59 ---- 838: 59: 59 year 1901 ---- 2155 timestamp 1970 10 10 80001----2038 time-related functions Now current_timestamp sysdate 1. Now and current_timestamp are the same 2. The sysdate function returns the time when the current function is executed, and the time when the now function returns the SQL statement. Time addition and subtraction If the target year is a leap month, the system automatically adds or subtracted one day. Date_add (date, interval expr unit) date_sub (date, interval expr unit) date_add (now (), interval 1 day) unit can be the following data: yearmonthdayweekhourminutesecondmicrosecond select Date_format (now (), '% Y % m % D ') As datetime;
Related Article

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.