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.
Select column1,column2 From MyTable
If we want to read all the columns in the table, we must use * as below.
Select * From MyTable
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.
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:
Select TOP 2 * FROM [dbo].[MyTable]
Select TOP 2 column1,column2 FROM [dbo].[MyTable]
Select TOP 25 Percent * FROM [dbo].[MyTable]