SQL Server SELECT proclamation is utilized to get the information from a data set table which returns information as result table. These outcome tables are called result-sets.
Syntax
Following is the fundamental grammar of SELECT proclamation −
SELECT column1, column2, columnN FROM table_name;
Where, column1, column2...are the fields of a table whose qualities you need to get. On the off chance that you need to get all the fields accessible in the field, at that point you can utilize the accompanying punctuation −
SELECT * FROM table_name;
Example
Consider the CUSTOMERS table having the accompanying records −
ID NAME AGE ADDRESS SALARY
1 Ramesh 32 Ahmedabad 2000.00
2 Khilan 25 Delhi 1500.00
3 kaushik 23 Kota 2000.00
4 Chaitali 25 Mumbai 6500.00
5 Hardik 27 Bhopal 8500.00
6 Komal 22 MP 4500.00
7 Muffy 24 Indore 10000.00
Following order is a model, which would get ID, Name and Salary fields of the clients accessible in CUSTOMERS table −
SELECT ID, NAME, SALARY FROM CUSTOMERS;
The above order will deliver the accompanying yield.
ID NAME SALARY
1 Ramesh 2000.00
2 Khilan 1500.00
3 kaushik 2000.00
4 Chaitali 6500.00
5 Hardik 8500.00
6 Komal 4500.00
7 Muffy 10000.00
On the off chance that you need to get all the fields of CUSTOMERS table, at that point utilize the accompanying inquiry −
SELECT * FROM CUSTOMERS;
The above will deliver the accompanying yield.
ID NAME AGE ADDRESS SALARY
1 Ramesh 32 Ahmedabad 2000.00
2 Khilan 25 Delhi 1500.00
3 kaushik 23 Kota 2000.00
4 Chaitali 25 Mumbai 6500.00
5 Hardik 27 Bhopal 8500.00
6 Komal 22 MP 4500.00
7 Muffy 24 Indore 10000.00