SQL Top

Posted On: December 29, 2015

The SQL TOP or LIMIT phrase is used to obtain TOP N number records from a table.

SQL Syntax:-
SELECT column_name FROM table_name LIMIT number;

Example:-

The subsequent SQL query selects 5 records from the “Visitors” table:
SELECT * FROM Visitors LIMIT 5;

Example2:-

The subsequent SQL query selects top 2 records from the “Visitors” table:
SELECT TOP 2 * FROM Visitors;

Example3:-

The subsequent SQL query selects the first 50% of the records from the “Visitors” table:
SELECT TOP 50 PERCENT * FROM Visitors;

Related Post

Also Read :   HTML Tables
X
Subscribe to our newsletter
Subscribe to our newsletter today to receive updates on the latest news and offers.
100% Privacy. No spam guaranteed
webe tutorial
Menu