Mysql Technology Insider-notes-Chapter 2 data types
Chapter 2 data types
- Do not use UNSIGNED in Mysql as it may bring unexpected results.
- Show create table tablename/G; view the TABLE creation statement
- ZEROFILL will automatically fill 0 when the width is smaller than the set
- We recommend that you SET SQL _MODE to strict mode in the production environment: set global SQL _mode = 'strict _ trans_tables ';
- 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.
- 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.
- 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;