1. First() Function :
In MS Access, the First() function is used to return a field value from the first record in the result set returned by a query.
Syntax :
First(expr)
Parameter :
- expr : It represents a string expression identifying the field that contains the data we want to use or an expression that performs a calculation using the data in that field.
Returns : It returns the first record in the result set.
Table – Employee_Details
| Emp_id | Emp_Name | Experience |
|---|---|---|
| 101 | Amit | 5 |
| 102 | Rahul | 10 |
| 103 | Suhani | 8 |
Example-1 :
SELECT First(Emp_id) AS EmployeeId FROM Employee_Details;
Output :
| EmployeeId |
|---|
| 101 |
Example-2 :
SELECT First(Emp_Name) AS FirstEmployee FROM Employee_Details;
Output :
| FirstEmployee |
|---|
| Amit |
2. Last() Function :
In MS Access, the Last() function is used to return a field value from the last record in the result set returned by a query.
Syntax :
Last(expr)
Parameter :
- expr : It represents a string expression identifying the field that contains the data we want to use or an expression that performs a calculation using the data in that field.
Returns : It returns the last record in the result set.
Example-2 :
SELECT Last(Emp_id) AS EmployeeId FROM Employee_Details;
Output :
| EmployeeId |
|---|
| 103 |
Example-2 :
SELECT Last(Emp_Name) AS LastEmployee FROM Employee_Details;
Output :
| LastEmployee |
|---|
| Suhani |
Recommended Posts:
- Val() and Sum() Function in MS Access
- Sgn() and Sqr() function in MS Access
- StrConv() and StrReverse() Function in MS Access
- Chr() and Asc() Function in MS Access
- InStr() and InstrRev() Function in MS Access
- LCase() and UCase () Function in MS Access
- Str() and StrComp() Function in MS Access
- Replace() and Space() Function in MS Access
- Exp() and Count() Function in MS Access
- Mid() and Len() Function in MS Access
- LTrim() and RTrim() Function in MS Access
- Left() and Right() Function in MS Access
- Rnd() and Round Function in MS Access
- Max() and Min() function in MS Access
- Fix() and Format() Function in MS Access
- Second() and Time() Function in MS Access
- MonthName() and Now() function in MS Access
- Month() and Minute() Function in MS Access
- Day() and Hour() Function in MS Access
- Date() and DateAdd() Function in MS Access
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

