413 views
3 votes
3 votes

I have a small doubt on order by clause usgae.I need to understand the position of null in case i order by ascending order or  desending order,I referred http://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqlj13658.html,whichsays order by puts null at last in asending order and at top in desc order.

But i tried some examples at http://www.w3schools.com/sql/sql_update.asp,which gave me opposite result.Please clarify

1 Answer

0 votes
0 votes

Please see this link

Person is using SQL Server 2008R2, Table column consist of NULL and it is sorted first.

But First comment on that is - Orcale list it Last.

So Implementation wise there is difference.

From Wikipedia

The SQL standard does not explicitly define a default sort order for Nulls. Instead, on conforming systems, Nulls can be sorted before or after all data values by using the NULLS FIRST or NULLS LAST clauses of the ORDER BY list, respectively. Not all DBMS vendors implement this functionality, however. Vendors who do not implement this functionality may specify different treatments for Null sorting in the DBMS

Related questions

0 votes
0 votes
2 answers
1
shikharV asked Dec 8, 2015
570 views
ABC52110NULL21523In the above relation T the output of query:select * from T group by B;ABC10NULL2521Can anyone explain why this is the output?
0 votes
0 votes
0 answers
2
vishal burnwal asked Aug 22, 2018
759 views
If aggregate functions are used in the select clause along with attribute list we must use group by clause for grouping the attribute values ?SELECT a1, COUNT(*) FROM Emp...
2 votes
2 votes
1 answer
3
Parshu gate asked Nov 6, 2017
3,997 views