14 lines
476 B
MySQL
14 lines
476 B
MySQL
|
-- LIMIT { ALL | integer_expression }
|
||
|
|
||
|
-- Select the first two rows.
|
||
|
SELECT name, age FROM person ORDER BY name LIMIT 2;
|
||
|
|
||
|
-- Specifying ALL option on LIMIT returns all the rows.
|
||
|
SELECT name, age FROM person ORDER BY name LIMIT ALL;
|
||
|
|
||
|
-- A function expression as an input to LIMIT.
|
||
|
SELECT name, age FROM person ORDER BY name LIMIT length('SPARK');
|
||
|
|
||
|
-- A non-foldable expression as an input to LIMIT is not allowed.
|
||
|
SELECT name, age FROM person ORDER BY name LIMIT length(name);
|