1. 程式人生 > >CAST(x, AS type)

CAST(x, AS type)

type lec -- 另一個 nbsp pan col 整數 類型

CAST(x, AS type) 用於將一個數據類型的值轉換為另一個數據類型的值

mysql> SELECT CAST(100 AS CHAR(2));   # 將整數類型100轉換為帶有兩個顯示寬度的字符串類型,結果為‘10‘
+----------------------+
| CAST(100 AS CHAR(2)) |
+----------------------+
| 10                   |
+----------------------+

CAST(x, AS type)