Mysql Technology Insider-notes-Chapter 2 data type _ MySQL

Source: Internet
Author: User
Mysql Technology Insider-notes-Chapter 2 data types

Chapter 2 data types

  1. Do not use UNSIGNED in Mysql as it may bring unexpected results.
  2. Show create table tablename/G; view the TABLE creation statement

  1. ZEROFILL will automatically fill 0 when the width is smaller than the set
  2. We recommend that you SET SQL _MODE to strict mode in the production environment: set global SQL _mode = 'strict _ trans_tables ';
  3. DATETIME occupies 8 bytes, DATE occupies 3 bytes, TIMESTAMP occupies 4 bytes, DATETIME and TIMESTAMP display results are the same, are fixed in the form of "YYYY-MM-DD HH: MM: SS, however, the display range is different, and the actual storage content of TIMESTAMP is the number of milliseconds from "00:00:00" to the current time.
  4. CURRENT_TIMESTAMP is a synonym for NOW. the SYSDATE function returns the time when the current function is executed, and NOW returns the time when the SQL statement is executed.
  5. Time operation functions: DATE_ADD and DATE_SUB

Select NOW () as now, DATE_ADD (NOW (), INTERVAL 1 DAY) as tomorrow, DATE_SUB (NOW (), INTERVAL 1 DAY) as yesterday/G;

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.