643 views
3 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 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

Position:
Show:

Related questions

0 0 votes
2 answers 2 answers
917
917 views
shikharV asked Dec 8, 2015
917 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 0 votes
0 0 answers
1.3k
1.3k views
vishal burnwal asked Aug 22, 2018
1,270 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 2 votes
1 1 answer
5.2k
5.2k views
Parshu gate asked Nov 6, 2017
5,194 views
2 2 votes
2 2 answers
1.2k
1.2k views
Tendua asked Dec 4, 2015
1,186 views
How does group by works. ya it make groups of the data . and what i know it will group the data. what what i found on running on the online tutorials is that , the group ...