MySQL语法入门(二)
MySQL语法入门(二)
数据库加密函数
1 | SELECT MD5('hello');-- 5d41402abc4b2a76b9719d911017c592 |
控制流函数
1 | SELECT IF(1 > 2, 3, 4);-- 4 |
SELECT DATE_FORMAT(NOW(), ‘%W %D %M %Y %r’);– Tuesday 14th January 2025 01:38:27 PM
SELECT TIME_FORMAT(‘25:11:44’, ‘%h:%i %p’);– 01:11 AM
SELECT INET_ATON(‘192.168.1.11’);– 3232235787;IP地址转成数字
SELECT INET_NTOA(3232235787);– 192.168.1.11;数字转成IP地址
SELECT 2 + ‘23’;– 25
SELECT 3 + CAST(‘11’ AS SIGNED);– 14
SELECT ‘f’ = BINARY ‘F’;– 0
SELECT ‘f’ = ‘F’;– 1
SELECT ‘f’ = CAST(‘F’ AS BINARY);– 0
SELECT ‘f’ = CAST(‘F’ AS CHAR);– 1
SELECT CONVERT( ‘14’ , SIGNED);– 14
SELECT CONVERT( ‘abc’ USING UTF8);– abc
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.