Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Sunday 24 May 2015

How to Fetch Top N records from SQL Database

The SQL TOP clause is used to fetch a TOP N number of records from a table.

The basic syntax is:-

SELECT TOP number|percent column_name(s)
FROM table_name
WHERE [condition if required] 

Example can be like:-

SELECT TOP 3 * FROM EMPLOYEES;

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.