Have you ever wondered if you can order your records of your report based on a column like I want to
be in alphabetical order or I want to sort them by ID or by Saturday for example locally in Eskdale
we can do that quite simply descale it supports ordering by any column either a whole column that is
exists in the table or a column that is a result of creation or a formula or a transformation.
But we did symbolize full name or not Saturday to do so.
What you can do is after from a statement we can add the new statement which is ORDER BY and make sure
that order and pi are separated from each other.
It's not a one word it's two words.
So this way we can tell a scale that what we want is we want this query to order the records based on
a column or several at once.
That's see how for example let's sort our report by formely in alphabetical order.
So what we can say is order by the full name here we don't need to use the double quotes.
It's ok the same as here.
By the way what we can do is in case you're alias's one word it's OK to not use double quotes but if
your report or your query will have a two or more words in the alias you need to use the courts in this
case anyway.
So here I said order by foggily.
If I run this and check the full name you'll see that it's all now sorted in alphabetical order starting
with a going to be going down to Z.
So this is sorting as simple as that.
You can sort of like Bob screens dates or numbers.
So if I want to add the numbers which is for example then it's Saturday I want served by the Saturday.
So I kind of come here and say that salary
in front of us again I don't see that necessary has been sorted.
And as you can see here we have this web developer in turn who's getting the lowest salary between the
employees since he's an intern and going up we can check that the salary is increasing.
In this column going down and you can see the highest salary in this company.
But all this is exhausting to go all the 400 about approximately 400 columns or records to see who has
the high salary.
If your search queries.
So what we can do is we can either sort assentingly or decently means that we can either sort from the
smallest to the biggest or big is the smallest if in case from numbers or dates and kids have strings
as he has for the full name it can be sorted from A to Z or from Z to any.
So how can you do that if you check the slide you'll see that order by supports two keywords.
The first is that a C which is the ascending order which takes the first three characters of ascending
word which is actually the default one.
So you really don't use it anyway because it's the default one in Askia.
But what we want to do is the descending order which is the second key word the A C which means this
in order for the first four characters of the something which will order or sort but cut the query based
on the columns that were specified in a descending order whether it's a number.
So it will be from the largest to the smallest or for a string to be from Z to a and c together coming
back to the query you would see that the next Saturday is order from smallest to biggest here.
But I'm so curious to see who has the biggest setter here in our company and I'm too lazy to go all
the way down so I can do here is I can come and say order by next Saturday and I will add the a c which
means that order let's hurry in a descending order from the largest to the smallest.
Let's run this and we can see now who has the biggest salary.
So he's a head of data which means like they're paying much for that these days.
So this is the huge salary or the biggest challenge we have in the company and go down and you see the
incentive is going lower and lower because we ordered the report based on the mid-century in a descending
order.
So what about if we want to sort it by Forni but in a descending order from this we will see that it's
now sorted from zero to 8.
And as you can see the full name.
The first one is zone now which is the letter Z.
Then you've gone and going down from y w v et cetera.
So this is how can the store your records or your data for equerry.