SQL - does order of OR conditions matter?
问题 I have to SELECT one row which meets condition1 OR condition2 . However, condition1 is preferable. If there are two rows, where the first one meets condition1 (and does not meet condition2) and second meets condition2 (and does not meet condition1 ) then the first one should be returned. So for SQL: SELECT * FROM table WHERE col1 = 1 OR col2 = 5 LIMIT 1 Will it return the row that meets condition col1 = 1 first? Or will it return rows in random order? If it will be random then how to achieve