How to Select Query In SQL



The select query in SQL server is basically used to select the data from a particular database. The data retrieved can be stored in the result table as well. In this tutorial we will see how to write select query in SQL.

Step 1 – Connecting to Database Server
First of all, let’s start by connecting to our SQL Server Database Server.

Connecting to SQL Server

Step 2 – Databases Directory
With that done, locate the Databases folder on the left side of the screen, under the Object Explorer tab and expand the directory.
Now we will expand the database in which we want to make the changes, and open up the Query Editor window, by right clicking on the database and selecting the “New Query” option.
Opening Query Editor

Step 3 – Writing Select Query
Now in the Query Editor, write “select” keyword.
select query in sql are used with various operators, keywords and function. Let us fetch all records from the database, for that we will use an asterisk sign followed by the name of the table from where we want to get the data from.
Select * from DEPT;
This is a very basic select query over here. Now you can click on the “execute” button on top or press the F5 shortcut key to run the query.
Select Query To Fetch All records

Step 4 – Execution
The query has been executed successfully and all the data is being displayed in the results section over here.
Executing the Query and viewing the results

And that is how we can use select query in SQL server.