Su problema es la falta de corchetes:en SQL AND
tiene prioridad sobre OR
, por lo que debe poner corchetes alrededor de toda su expresión anterior:
SELECT * FROM dim_date
WHERE ( -- added bracket
EXTRACT (MONTH FROM date_cal) BETWEEN 3 AND 5
OR (EXTRACT (MONTH FROM date_cal) = 2 AND EXTRACT (DAY FROM date_cal) >= 15)
OR (EXTRACT (MONTH FROM date_cal) = 6 AND EXTRACT (DAY FROM date_cal) <= 21)
) -- added bracket
AND EXTRACT (YEAR FROM date_cal) BETWEEN 2010 AND 2012
Sin los corchetes, obtienes A or B or (C and D)
, pero quieres (A or B or C) and D