線上問題集錦(2)

架構路上發表於2020-12-31

mysql and 和 or為什麼會導致效能差別巨大?

select t1.* from t_user t1,   t_student_info t2  where t1.user_unique_code = t2.uu_id   
and 
( t1.user_name like '%譚%'  or  t2.student_no like '%譚%'  or  t2.company like '%譚%'  ) 
ORDER BY t1.create_time desc 
select t1.* from t_user t1,   t_student_info t2  where t1.user_unique_code = t2.uu_id   
or 
( t1.user_name like '%譚%'  or  t2.student_no like '%譚%'  or  t2.company like '%譚%'  ) 
ORDER BY t1.create_time desc 

相關文章