Monday, 16 July 2018

Use of "Order by field" in MySQL

Use of "Order by field" in MySQL

There is also a field in MySQL that is incrementing ( ascending - asc ), decreasing ( descending - desc ), and random ( random ) .
Field allows you to sort by sorting the items you want in one area and the proper use of MySQL's query ( search ) increases the speed.

Use of

After the order by field is written, the first parameter is: which field to sort on, followed by the next parameter in which order. I also note that; you can type desc " outside the parentheses if you want to reverse the order according to the situation .

Sample

For example, in a shopping site, sort by category name, and in doing so, use the field sort feature. In doing so, we will write 2 queries.
The first step is to take a sequence of categories;
Now it is time to bring products;
I hope the sample helps you understand better ...

Performance

I did not do a detailed research on performance, but if I were to do construction-dismantling;

0 comments:

Post a Comment