SQL: Just like tables, IN clauses have no default order
In Stack Overflow, I saw a poster with a query like this:
select * from student where stud_id in (
'5',
'3',
'4'
)
And he was frustrated that he couldn’t reliably get an ordered output like this:
id| name |
5 | John |
3 | Erik |
4 | Michael |
The problem is that he was assuming that the IN clause had a specified order that was then obeyed by the SELECT statement.
2019-10-31