How does order by clause works if two values are equal?

后端 未结 3 757
北荒
北荒 2021-01-11 10:44

This is my NEWSPAPER table.

    National News   A   1
    Sports          D   1
    Editorials      A   12
    Business        E   1
    Weather         C            


        
3条回答
  •  说谎
    说谎 (楼主)
    2021-01-11 11:18

    When you use the SELECT statement to query data from a table, the order which rows appear in the result set may not be what you expected.

    In some cases, the rows that appear in the result set are in the order that they are stored in the table physically. However, in case the query optimizer uses an index to process the query, the rows will appear as they are stored in the index key order. For this reason, the order of rows in the result set is undetermined or unpredictable.

    The query optimizer is a built-in software component in the database system that determines the most efficient way for an SQL statement to query the requested data.

提交回复
热议问题