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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容