mysql之使用数据处理函数

1.文本处理函数

Upper(): 将文本转换为大写

如:
select h_title,upper(h_title) as up_title from h_info;
结果如下:
mysql之使用数据处理函数
mysql之使用数据处理函数

2.时间处理函数

时间相关的两种数据类型:
  • date:只包含日期, 形如2020-01-02
  • datetime:包含日期和时间,形如2020-02-02 00:00:00
    mysql之使用数据处理函数
    例子:
    Date()函数 :select * from h_info where Date(date) = “2020-02-03”;
    Year()函数 :select * from h_info where Year(date) between “2010” and “2020”;
    Day()函数 : select * from h_info where Day(date) = 3 and Month(date) = 2;

3.数值处理函数

mysql之使用数据处理函数