What is a SELECT Query?
A SELECT query enables you to retrieve data from a table. You can imagine it like saying to the database, "Please display the details that I require."
Basic Syntax :
SELECT column1, column2, ...
FROM table_name;
Select all Records from Table With * (This will show all columns):
Syntax :
Select * from CountryMaster
Filter Result with Where :
Select * from CountryMaster where CountryName='India'
Sort the Data with "Order by " (By default it ascending ):
Select * from CountryMaster Order by countryname desc
Get Unique Result with "DISTINCT" :
Select distinct * from CountryMaster
Giving Names to Columns with AS :
Select CountryId as [country id],CountryName as [Country name] from CountryMaster
.