When working with databases, it is often necessary to display the query result in a certain order, for example, alphabetically. To do this, the DBMS has a special function in SQL - sorting. In this case, the programmer can choose which fields and in what order it will occur in order to achieve the desired result, without applying serious programming skills.
What is sorting in a database?
Working with databases is constantly associated with a large amount of information, which must determine the order. Currently, there are a number of DBMSs with a wide range of functions, the most popular of which are Oracle and MS SQL. Sorting information, as one of the main procedures in working with the database, is provided by a special built-in function in each of them.
, . SQL- , , , , .
SQL- ORDER BY. , , , , , .
, People Name Age, Name, : SELECT Name, Age FROM People ORDER BY Name.
?
, , - , ? SQL . , , ORDER BY, , .
DESC. , , , . , DESC , , .
SQL-, . , " ", . "", , " ", , " ", .
Writing the algorithm yourself will not significantly increase the speed of sorting, however, it will contribute to the development of programming skills, and will also allow you to modify the process by adjusting the ranking scheme for a specific database to increase the efficiency of the program.