Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

MySQL first


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:

  1. SELECT column_name
  2. FROM table_name
  3. LIMIT 1;

MySQL first function example

To SELECT FIRST element:

Consider a table named “officers”, having the following data.

mysqlfirst1

Execute the following query:

  1. SELECT officer_name
  2. FROM officers
  3. LIMIT 1;

Output:

mysqlfirst2

To SELECT FIRST two records

  1. SELECT officer_name
  2. FROM officers
  3. LIMIT 2;

Output:

mysqlfirst3

Comments

comments