Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Return Top 5 Rows
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries
✍: FYIcenter.com
If you want the query to return only the first 5 rows, you can use the LIMIT clause, which takes one parameter as the maximum number of rows to return. The following statement returns the first 5 rows from the fyi_links:
mysql> SELECT id, url, counts, tag FROM fyi_links ORDER BY counts DESC LIMIT 5; +-----+-------------------+--------+------+ | id | url | counts | tag | +-----+-------------------+--------+------+ | 107 | www.winrunner.com | 8 | SQA | | 105 | www.oracle.com | 7 | DBA | | 103 | sqa.fyicenter.com | 6 | SQA | | 101 | dev.fyicenter.com | 4 | DEV | | 106 | www.php.net | 4 | DEV | +-----+-------------------+--------+------+ 5 rows in set (0.00 sec)
2007-05-11, 7511👍, 0💬
Popular Posts:
What is the difference between "printf(...)" and "sprintf(...)"? sprintf(...) writes data to the cha...
What is the benefit of using #define to declare a constant? Using the #define method of declaring a ...
How To Define a Data Source Name (DSN) in ODBC Manager? - Oracle DBA FAQ - ODBC Drivers, DSN Configu...
Can include files be nested? The answer is yes. Include files can be nested any number of times. As ...
Can one execute dynamic SQL from Forms? Yes, use the FORMS_DDL built-in or call the DBMS_SQL databas...