mariana
Pun Pundit
LEVEL 1
100 XP
The FIRST function returns the first value of the selected column. FIRST function is not standard SQL function so it cannot be used with other DBMS like MySQL. However this is very useful with MS Access OR SQL Server.
SQL FIRST() Syntax
SELECT
FIRST
(
column_name)
FROM
TABLE
Consider the following table for this exercise
Users
Firstname
Lastname
Salary
DeptID
John
Smith
1000
1
Mathew
Simon
3000
1
Bill
Steve
2200
1
Amanda
Rogers
1800
2
Steve
Hills
2800
2
Steve
jobs
2400
2
bill
cosby
700
3
Example # 1
SELECT
FIRST
(
Firstname)
AS
FIRST
FROM
Users
Result of the Query
First
John
The result is shows the firstname of the first row.
SQL FIRST() Syntax
SELECT
FIRST
(
column_name)
FROM
TABLE
Consider the following table for this exercise
Users
Firstname
Lastname
Salary
DeptID
John
Smith
1000
1
Mathew
Simon
3000
1
Bill
Steve
2200
1
Amanda
Rogers
1800
2
Steve
Hills
2800
2
Steve
jobs
2400
2
bill
cosby
700
3
Example # 1
SELECT
FIRST
(
Firstname)
AS
FIRST
FROM
Users
Result of the Query
First
John
The result is shows the firstname of the first row.