All for Joomla All for Webmasters

SQL SELECT FIRST

The SQL first() function is used to return the first value of the selected column.

Let’s see the syntax of sql select first() function:

  1. SELECT FIRST(column_name) FROM table_name;

Here a point is notable that first function is only supported by MS Access.

If you want to retrieve the first value of the “customer_name” column from the “customers” table, you need to write following query:

  1. SELECT FIRST(customer_name) AS first_customer FROM customers;

Let us take the example of CUSTOMERS to examine SQL SELECT FIRST command:

Table CUSTOMERS

CUSTOMER_NAME AGE ADDRESS EXPENDITURE
KAMAL SHARMA 26 GHAZIABAD 6000
ROBERT PETT 23 NEWYORK 26000
SHIKHA SRIVASTAV 22 DELHI 9000

If you want to retrieve the first value of the “customer_name” column from the “customers” table, you need to write following query:

Let’s see the syntax of sql select first() function:

  1. SELECT FIRST (CUSTOMER_NAME) AS first_customer FROM CUSTOMERS;
  2. After that query, you will find the result:
  3. KAMAL SHARMA
PinIt
submit to reddit

Leave a Reply

Top