MYSQL笔记之MySQL常用函数/方法

修改mysql密码:

 

mysql查询去重:distinct

举例:

select distinct+ 字段名 from +表名;

 

>>mysql中的 ‘+’ 号只有运算符的功能,不能拼接字符串。拼接字符串有专门的函数 concat() ;

例如:select '123'+1;   得到:124;

           select 'hello'+1;   得到:1;

           select null+1;   得到:null;

           select 'hello'+'world';    得到:0;

cancat() 使用:如  select concat('张','三');  得到:张三;

 

刚刚又学到一个新的函数:ifnull()

语法:ifnull(字段名,其他值);

如有一个字段name,它有四个值:张三,李四,null,王五。

使用ifnull方法:ifnull(name,'灭霸');

则为null的值都会变为‘灭霸’。

MYSQL笔记之MySQL常用函数/方法_第1张图片

 

 

 

mysql模糊查询:

like,

between

你可能感兴趣的:(mysql,MySQL函数,Java,mysql笔记,MySQL常见函数)