Order by: the actual ordering of data is performed in a single node.
hive> select * from emp order by ename desc/descending;
Sort by: if data is stored across more than one node, partial sorting is done node wise, but it can't be 100% perfect sorting. Can use ascending/asc , descending/desc for ascending and descending sorting.
hive>select * from emp sort by ename asc;
hive> select * from emp order by ename;
can use asc/ascending for ordering.
data will be order by ename ASCENDING by default.
hive> select * from emp order by ename desc/descending;
data will be order by ename DESCENDING.
Sort by: if data is stored across more than one node, partial sorting is done node wise, but it can't be 100% perfect sorting. Can use ascending/asc , descending/desc for ascending and descending sorting.
Following will display the data sorted by ename in ascending order.
hive>select * from emp sort by ename asc;