Mysql-基础

sql语句得执行顺序

FROM -- 待完善
JOIN --
NO --
WHERE --
GROUP BY -- 
AVG,SUM .... --
HAVING --
SELECT --
DISTINCT --
ORDER BY --
LIMIT --

参考


隐式转换

mysql> select 1+'1'; -- 1+1 
+-------+
| 1+'1' |
+-------+
|     2 |
+-------+
1 row in set (0.00 sec)

mysql> select 1>'x6'; -- 1>0 字符开头自动转为0 
+--------+
| 1>'x6' |
+--------+
|      1 |
+--------+
1 row in set, 1 warning (0.00 sec)

mysql> select 1>'6x';-- 1>6
+--------+
| 1>'6x' |
+--------+
|      0 |
+--------+
1 row in set, 1 warning (0.01 sec)

mysql> select 1> null; -- null
+---------+
| 1> null |
+---------+
|    NULL |
+---------+
1 row in set (0.00 sec)

mysql> select '1'+'1'; -- 1+1 
+---------+
| '1'+'1' |
+---------+
|       2 |
+---------+
1 row in set (0.00 sec)

mysql> select '1'+'1xd';-- 1+1
+-----------+
| '1'+'1xd' |
+-----------+
|         2 |
+-----------+
1 row in set, 1 warning (0.00 sec)

参考


编码设置

参考