0

I am fairly new to MySQL and would like to ask how can you fine tune this query or rewrite it in a better way.

 SELECT *
 FROM emp
 WHERE birth_date BETWEEN '1999-05-01'
 AND '1999-05-31'
 OR last_name in ('Bart', 'Martha', 'Lisa');

Your assistance is greatly appreciated. Can you also explain why you did it so I would know

Thanks.

Emc_tgn15
  • 161
  • 1
  • 1
  • 11

2 Answers2

1

I think this question SQL Performance UNION vs OR is what you are looking for the first answer explains the difference between OR and UNION and in your case this might be the best optimization.

1

You can also use the EXPLAIN command to get more insight about your query and how you can optimize it.

Liron
  • 515
  • 4
  • 20