Time Stamp Conversion
DateTime conversion to Timestamp: Unix_timestamp ()
Timestamp converted to Datetime:from_unixtime ()
Mysql> Create TableTesttime (IDintAuto_increment not NULL, Timestrint,PRIMARY KEY(ID)); Query OK,0Rows Affected (0.01sec) MySQL> descTesttime;+---------+---------+------+-----+---------+----------------+|Field|Type| Null | Key | Default |Extra|+---------+---------+------+-----+---------+----------------+|Id| int( One)|NO|Pri| NULL |Auto_increment||Timestr| int( One)|YES| | NULL | |+---------+---------+------+-----+---------+----------------+2Rowsinch Set(0.01sec) MySQL> Insert intoTesttime (TIMESTR)Values(Unix_timestamp ('2014-06-01 21:00:00')); Query OK,1Row affected (0.00sec) MySQL> SelectFrom_unixtime (TIMESTR) fromTesttime;+------------------------+|From_unixtime (TIMESTR)|+------------------------+| the- .- on +:xx:xx |+------------------------+1Rowinch Set(0.00sec) MySQL>
Uppercase and lowercase conversions
Lowercase converted to uppercase: UPPER ()
Convert uppercase to smaller: LOWER ()
Mysql> Select LOWER(title) fromFilm Limit4\g*************************** 1. Row***************************LOWER(title): Academy Dinosaur*************************** 2. Row***************************LOWER(title): Ace Goldfinger*************************** 3. Row***************************LOWER(title): Adaptation Holes*************************** 4. Row***************************LOWER(title): Affair Prejudice4Rowsinch Set(0.00Sec
MySQL Common functions