跳至主要內容

mysql运算符

张威小于 1 分钟mysqlmysql基础

MySQL运算符

算数运算符

image-20240406210003709
image-20240406210003709

运算后的结果如果需要存储在表内,需要注意

update user set age = age + 1

逻辑运算符

image-20240406210021446
image-20240406210021446

取反:当满足条件时,返回不满足条件的部分( 使用!记得加上括号()

比较运算符

image-20240406210040984
image-20240406210040984
  1. 不等于 用!=

  2. 区间 between

  3. 判断是否为空 is NULL; is not NULL

  4. 通配符 LIKE

    1. _匹配一个字符 %匹配一个到多个字符
    2. 通配符在最前面不能使用索引查询;在中间或后面可以使用索引
select * insert Employeeaddress where  addressID in (select AddressID from noNF where EmployeeID=1);
  • in的效率其实不高