LMSouq
database Open

MySQL OR vs IN performance

SC
Scott
1 month ago
3 views
Problem Description
I am wondering if there is any difference with regards to performance between the following SELECT ... FROM ... WHERE someFIELD IN(1,2,3,4) SELECT ... FROM ... WHERE someFIELD between 0 AND 5 SELECT ... FROM ... WHERE someFIELD = 1 OR someFIELD = 2 OR someFIELD = 3 ... or will MySQL optimize the SQL in the same way compilers optimize code? --- ### EDIT Changed the `AND`'s to `OR`'s for the reason stated in the comments.

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base