MySQL first function

The MySQL first function is used to return the first value of the selected column. Here, we use limit clause to select first record or more.

Syntax:

snippet
SELECT column_name
FROM table_name
LIMIT 1;

MySQL first function example

To SELECT FIRST element:

Consider a table named "officers", having the following data.

mysql first() 1

Execute the following query:

snippet
SELECT officer_name 
FROM officers
LIMIT 1;

Output:

mysql first() 2

To SELECT FIRST two records

snippet
SELECT officer_name 
FROM officers
LIMIT 2;

Output:

mysql first() 3
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents