What is the purpose of the ORDER BY clause in a Databricks SQL query?
The ORDER BY clause in a Databricks SQL query is used to sort the rows of the complete result set based on the specified columns or expressions. The rows are ordered across the partitions, and this clause is mutually exclusive with SORT BY, CLUSTER BY, and DISTRIBUTE BY. It is often used with the LIMIT clause to produce a deterministic result.