SQL Certification - SPLessons

SQL Certification Limit

Home > Lesson > Chapter 24
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQL Certification Limit

Limit

shape Description

Limit Clauses are utilized as a part of the SELECT statement to compel the quantity of columns in an outcome intends. The Limit statement will take only a couple of contentions. The estimations of both contentions must be zero or positive numbers.

shape Syntax

The syntax for Limit clause is as follows:
Select * from <table_name> Limit count;
table name => The accurate table name in the database. Limit => Is a SQL clause. Count => Specifies the number of rows to be return.

shape Examples

By viewing the below example, the concept of SQL Limit clause can be easily understood. [c]sql> select * from employee21; +--------+-------+-------+--------+-----------+ | emp_id | ename | sal | deptno | job | +--------+-------+-------+--------+-----------+ | 1001 | mike | 12000 | 10 | manager | | 1002 | rambo | 13000 | 20 | scalesman | | 1003 | kate | 14000 | 10 | manager | | 1003 | jeo | 14000 | 20 | manager | | 1003 | finn | 14000 | 30 | manager | +--------+-------+-------+--------+-----------+ 5 rows in set (1.30 sec) sql> select * from employee21 limit 3; +--------+-------+-------+--------+-----------+ | emp_id | ename | sal | deptno | job | +--------+-------+-------+--------+-----------+ | 1001 | mike | 12000 | 10 | manager | | 1002 | rambo | 13000 | 20 | scalesman | | 1003 | kate | 14000 | 10 | manager | +--------+-------+-------+--------+-----------+ 3 rows in set (0.00 sec)[/c] Here in the above example the Limit clause will limit the number of columns to a certain limit so that only desired output will get displayed.

Summary

shape Key Points

  • Limit - Limit clause will limit the number of rows inserted in the tables.