which sql query time do you prefer?

maidos

Active member
new at sql so need your opnions which query you prefer for selecting months? these two are meant to do same thing

SELECT ftgnamn,​
erbjnamn,​
sokarnr,​
intervjutidpunkt,​
loneansprak​
FROM ansokan​
WHERE MONTH(intervjutidpunkt) = 11​
OR intervjutidpunkt IS NULL​

or


select ftgnamn, erbjnamn, sokarnr, intervjutidpunkt, loneansprak​
from ansokan​
where intervjutidpunkt between '2010-11-01' and '2010-11-30' or intervjutidpunkt is null​
order by intervjutidpunkt​
 
The second one should allow an index to be used, if there is one that's applicable.
 
Back
Top Bottom