FCI-Helwan blog

Just another FCI-H weblog

Top 10 syntax (Oracle and SQL)

As my experience in Microsoft development, I was think that the syntax for retrieving top 10 records in SQL server is same with Oracle but unfortunately they were different so here the syntax of both :


SELECT TOP 10 age FROM Employees


SELECT age FROM Employees WHERE ROWNUM <= 10


July 10, 2008 - Posted by | Uncategorized

1 Comment »

  1. Oracle statement should not work, because Oracle returns data in random order. You have to order the data in a subquery before getting the top N rows.

    Comment by Anonymous | March 25, 2009 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: