The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

What is the second rule when organizing records when ORDER BY (for ex. first_name) is used and more people have same first_name?

What is the second rule when organizing records when ORDER BY (for ex. first_name) is used and more people have same first_name?

Super Learner
0
Votes
1
Answer

Hello.

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.

Cheers,
Maros J

1 Answer

365 Team

Hi Maros!
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.
Best,
Martin

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.

5 months

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!

5 months