Select Statement in SQL Server(TSQL)

We use the Select statement to read data from the database. If we want to read the specific columns in the table, we need to specify the corresponding column names as follows.

If we want to read all the columns in the table, we must use * as below.

Usually application developers prefer to read all the columns in the table with *. But only the needed columns should be read for the application to work more efficiently.

Select TOP:

Instead of reading all of the records in the table, we can only read as much as we specify with the Select Top statement. We specify the number of records we want to read by specifying a number in the top expression.

The use of the example is as follows:

or

or

dbtut
Author: dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *