开发过程中遇到个需求,用户要提取的数据列中不包含 YF、ZF、JD的字符串,

方法1:select * from table  where  order_no not like '%YF%' and order_no not like '%ZF' and order_no not like '%JD%' 

感 觉方法1有点笨,想到REGEXP_LIKE 可以实现包含多个,在前面加上 not 就可以实现不包含功能,方法如下:

方法2:select * from table where not regexp_like(order_no,'YF|ZF|JD')   

两种方法都可以实现,但效率问题,经查询两个月11万条数据做比效方法1用时18秒,方法2用时15秒,连续测试三次方法1总是比方法快2至3秒,如果数据量大的还是建议使用方法1!

相关文章:

  • 2021-03-15
  • 2021-07-11
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2021-03-14
相关资源
相似解决方案