Home SQL Top
E-mail Print PDF

TOP

Note - Note:

1
2
SELECT TOP number|percent column_name(s)
FROM table_name

1
2
3
SELECT column_name(s)
FROM table_name
LIMIT number

1
2
3
SELECT *
FROM Persons
LIMIT 5

1
2
3
SELECT column_name(s)
FROM table_name
WHERE ROWNUM <= number

1
2
3
SELECT *
FROM Persons
WHERE ROWNUM <=5

There is a table "Persons":

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Tom Vingvn 23 Stavanger

1
SELECT TOP 2 * FROM Persons

Query Result:

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes

использования процентов в SQL TOP

There is a table "Persons":

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Tom Vingvn 23 Stavanger

1
SELECT TOP 50 PERCENT * FROM Persons

Query Result:

P_IdLastNameFirstNameAddressCity
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes

Comments

 
-6 #1 villian 2010-06-09 11:24 Some databases support only multiples of ten and five arguments. Ie , ... Well you get the idea. Quote
 
 
+5 #2 Irina 2010-10-20 08:35
Some databases support only multiples of ten and five arguments. Ie , ... Well you get the idea.


and which support the TOP 2 TOP for example?
Quote
 

Authorization

Nice Ajax Poll

Which one of my extensions is the best?

Statistics

Translate

русскийitalianoDeutschEnglishLATVIANукраїнськаfrançaispolski
1

Advertisement