The best SQL SELECT TOP, LIMIT, ROWNUM Tutorial In 2024, In this tutorial you can learn SQL SELECT TOP clause,MySQL and Oracle in the SQL SELECT TOP is equivalent to,The demo database,Examples of SQL SELECT TOP,Examples,SQL SELECT TOP PERCENT examples,Examples,
SELECT TOP clause is used to provide for the number of records returned.
SELECT TOP clause to have thousands of records of a large table, it is very useful.
Note: Not all database systems support the SELECT TOP clause.
In this tutorial, we will use w3big sample database.
The following is a selected "Websites" table data:
mysql> SELECT * FROM Websites; +----+---------------+---------------------------+-------+---------+ | id | name | url | alexa | country | +----+---------------+---------------------------+-------+---------+ | 1 | Google | https://www.google.cm/ | 1 | USA | | 2 | 淘宝 | https://www.taobao.com/ | 13 | CN | | 3 | 本教程 | http://www.w3write.com/ | 5000 | USA | | 4 | 微博 | http://weibo.com/ | 20 | CN | | 5 | Facebook | https://www.facebook.com/ | 3 | USA | | 7 | stackoverflow | http://stackoverflow.com/ | 0 | IND | +----+---------------+---------------------------+-------+---------+
The following SQL statement to select the first two records from the "Websites" table:
Execute the above SQL, with the following data:
In Microsoft SQL Server can also be used as an argument percentage.
The following SQL statement to select from in front of "Customers" table, 50% of the record:
Perform the following actions in Microsoft SQL Server database.