Open In App


Last Updated : 09 May, 2024
Like Article

SQL SELECT FIRST retrieves the first/top row from the table and displays it in the results set.


The SELECT FIRST clause in SQL is used to fetch the first record from a column.

This FIRST query can be used for Employee management systems, inventory management, and billing systems.

Note: The SELECT FIRST clause is not universally supported across all SQL platforms. Some variations of the FIRST clause in other databases are LIMIT, TOP, or FETCH FIRST.


The syntax to use the SELECT FIRST clause in SQL is:

SELECT FIRST (columnName) FROM tableName;


Let’s look at an example of the SELECT FIRST query in SQL.

This query can only be used in MS Access.

In this example, we will select the first name for the table “stationary”.

SELECT FIRST (Name) AS First_name FROM Stationary;

How to Use SQL SELECT FIRST Clause

Follow the given steps to use the SELECT FIRST clause in SQL.

So we will start by creating a database to perform the operations.

Step 1: Create a database.


Step 2: Use this database


Step 3: Create a table

/****** (1,1) indicates that increment 1 every time insert is performed ******/


Step 4: Check the created table schema  

table schema

Schema of table

Step 4: Insert the values in Table

/****** Insertion queries ******/

INSERT INTO [dbo].[first]
('Devesh', 20, 'CSE')

INSERT INTO [dbo].[first]
('Aditya', 19, 'BT')

INSERT INTO [dbo].[first]
('Megha', 20, 'CSE')

inserting values

Step 5: Use first() function in table( first() is used in MS ACCESS ).

SELECT TOP 1 Name FROM first

select top query

Important Points About SQL SELECT FIRST

  • The SELECT FIRST command in SQL is used to retrieve only the top row from a table.
  • SELECT FIRST can be beneficial for various purposes like login-related functions on websites or implementing billing systems.
  • The SELECT FIRST clause is not universally supported across all SQL systems. It is primarily used in MS Access.
  • It can used with other clauses like ORDER BY.

Previous Article
Next Article

Similar Reads

SQL - SELECT from Multiple Tables with MS SQL Server
In SQL we can retrieve data from multiple tables also by using SELECT with multiple tables which actually results in CROSS JOIN of all the tables. The resulting table occurring from CROSS JOIN of two contains all the row combinations of the 2nd table which is a Cartesian product of tables. If we consider table1 contains m rows and table2 contains n
3 min read
How to SQL Select from Stored Procedure using SQL Server?
There may be situations in SQL Server where you need to use a stored procedure to get data from a SQL query. For direct data selection from a stored procedure within a query, SQL Server offers options like OPENQUERY and OPENROWSET. The usual way is running the stored procedure independently and then querying the outcomes. The idea of utilizing SQL
3 min read
How to Select the First Row of Each GROUP BY in SQL?
The GROUP BY Statement in SQL is used to arrange identical data into groups with the help of some functions. To select the first row of each group in SQL, you can use the ' GROUP BY ' clause with the ' MIN ' or ' MAX ' aggregate function. SyntaxSELECT * FROM yourTable WHERE columnName = (SELECT MIN(columnName) FROM yourTable GROUP BY groupColumnNam
3 min read
Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
Structured Query Language (SQL): Structured Query Language (SQL) has a specific design motive for defining, accessing and changement of data. It is considered as non-procedural, In that case the important elements and its results are first specified without taking care of the how they are computed. It is implemented over the database which is drive
2 min read
Configure SQL Jobs in SQL Server using T-SQL
In this article, we will learn how to configure SQL jobs in SQL Server using T-SQL. Also, we will discuss the parameters of SQL jobs in SQL Server using T-SQL in detail. Let's discuss it one by one. Introduction :SQL Server Agent is a component used for database task automation. For Example, If we need to perform index maintenance on Production ser
7 min read
In SQL, we have databases that contain tables where our data is present. If we want to select some data from this table then we make use of the SELECT clause with FROM clause specifying the table. We can apply some conditions to our selections using the WHERE clause. Now some cases might be there where we are required to change the name of data sel
2 min read
Select statement in MS SQL Server
In this article, the most basic statement used in SQL is being discussed. Basic statement: select There are large amounts of data available everywhere. The data is stored in a sequential order in form of a table. Each table consists of a row which represents a unique record and column represents a field. Schemas are used to arrange the tables in a
2 min read
Select top in MS SQL Server
Prerequisite - Select in MS SQL Server Suppose that a user wants to extract the top students from the whole institution but has to use some complex queries to extract the data. To avoid complexity, the user can use 'Select Top'. 'Select Top' extracts the limited number of rows. This results in accurate data along with less time consumption. Syntax
2 min read
Insert Into Select statement in MS SQL Server
Prerequisites - Insert statement in MS SQL Server, Select statement in MS SQL Server Consider a university database. There are two tables namely Student and Marks. In case, the marks of a few students has to be transferred from the marks table to the marks table, there are many ways to do so. One can use subqueries (query nested in another query) b
2 min read
SELECT data from Multiple Tables in SQL
The statement is used to retrieve the fields from multiple tables and with the help of JOIN operations we easily fetch the records from multiple tables, Generally JOINS are used when there are common records between two tables. In this article, we will look into various types of JOIN that are used in SQL. SQL JoinsSQL joins combine two or more tabl
3 min read
Article Tags :