What is the second rule when organizing records when ORDER BY (for ex. first_name) is used and more people have same first_name?
Is there some rule or is it random?
Thanks for reaching out.
In this particular lecture, we only provide an example. Otherwise, you can use the primary key when ordering the data, for instance. Alternatively, depending on the situation, you could add a second field like this:
ORDER BY first_name, last_name DESC;
Hope this helps.
Hello Martin, Thank you for your reply. Then, if not second field or primary key is given, the order of records with same first name is random? It is pure curiosity from my side and maybe it is not even important, i am just wondering if there is some sort of information in table, which remember order of records by its insertion or something like that. It could be used if it would be true.
Hi Maros! Please excuse me for not getting back to you sooner. There are indexes, and you’ll learn about them later in the course. In the meantime, please don’t skip the lectures and exercises and run all code that has been made available. In this way, you will better internalise how to use ORDER BY (and everything else we teach!). Hope this helps!