mysql 操作(字符串截取和 exists ,not exists)

从右开始截取
right(str, length)
说明:right(被截取字段,截取长度)


从左开始截取
left(str, length)
说明:right(被截取字段,截取长度)

substring(str, pos)
说明:substring(被截取字段,从第几位开始截取)
substring(str, pos, length)
说明:substring(被截取字段,从第几位开始截取,截取长度)

substring_index(str,delim,count)
说明:substring_index(被截取字段,关键字,关键字出现的次数)

mysql "exists"和“not exists"的区别

表:
base_store_info

ml_store_product

base_product
select name
 from base_store_info
        where not exists (select * from ml_store_product where ml_store_product.store_sid=base_store_info.sid)
      

结果:


not exists
    select sid,name
 from base_store_info
        where exists (select * from ml_store_product where ml_store_product.store_sid=base_store_info.sid)  

结果:


exists

你可能感兴趣的:(mysql 操作(字符串截取和 exists ,not exists))