Javatpoint Logo

91-9990449935

 0120-4256464

Javatpoint Logo

SQL SELECT LAST

The last() function is used to return the last value of the specified column.

Syntax for SQL SELECT LAST() FUNCTION:

You should note that the last() function is only supported in MS Access. But there are ways to get the last record in MySql, SQL Server, Oracle etc. databases.

My SQL syntax:
SQL Server syntax:
Oracle syntax:

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

Table CUSTOMERS

CUSTOMER_NAMEAGEADDRESSEXPENDITURE
KAMAL SHARMA26GHAZIABAD6000
ROBERT PETT23NEWYORK26000
SHIKHA SRIVASTAV22DELHI9000

If you want to retrieve the last value of the "customer_name" column from the "customers" table, you need to write following query:

Next TopicSQL Select Random




Latest 4 Tutorials on JavaTpoint