By 25/02/2016 1 Comments

What Is SELECT TOP Clause In SQL?

  • SQL SELECT TOP clause returns the specified numbers of records from database tables.
  • SQL SELECT TOP clause becomes very useful when we have a large table which contains thousand records in a database.
  • Some database systems do not support the SELECT TOP clause.

Syntax: SQL Server & MS Access

SELECT TOP number|percent column_name(s)
FROM table_name;

Example:

SELECT TOP 3 p_name, price, p_date
FROM products;
  • In above example only top 3 records will be selected.

Syntax: MySQL

SELECT column_name(s)
FROM table_name
LIMIT number;

Example:

SELECT *
FROM products
LIMIT 2;
  • In above example only top 2 records will be selected.

Syntax: Oracle

SELECT column_name(s)
FROM table_name
WHERE ROWNUM <= number;

Example:

SELECT *
FROM products
WHERE ROWNUM == 2;
  • In above example only top 2 records will be selected.






← Previous Tutorial


Posted in: Sql

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .