參考博客: https://www.cnblogs.com/chenqionghe/p/4675844.html
CAST(x AS type)
CONVERT(x,type)
這兩個函數只對BINARY、CHAR、DATE、DATETIME、TIME、SIGNED INTEGER、UNSIGNED INTEGER。
SELECT CAST('123' AS UNSIGNED INTEGER) + 1 ->124 SELECT '123' + 1 ->124 其實MySQL能默認轉換 SELECT CAST(NOW() AS DATE) ->2014-12-18
例如:
數據庫中user表中 magicstr字段是16進制字符 轉換成10進制 再被sha1編碼
update sigma_account_us_user set `password`= SHA1(CONVERT( magicstr, SIGNED )) where id=467450
