Thursday, 18 September 2014

SQL SELECT Query

SQL SELECT Statement is used to fetch the data from a database table which returns data in the form of
result table. These result tables are called result-sets.
Syntax :-
The basic syntax of SELECT statement is as follows :-

SELECT column1, column2, columnN FROM table_name;

Here, column1, column2...are the fields of a table whose values you want to fetch. If you want to fetch all the fields available in the field, then you can use the following syntax :-

SELECT * FROM table_name;

Example :-
Consider the CUSTOMERS table having the following records :-
Following is an example, which would fetch ID, Name and Salary fields of the customers available in 
CUSTOMERS table :-

SELECT ID, NAME, SALARY FROM CUSTOMERS;

This would produce the following result :-
If you want to fetch all the fields of CUSTOMERS table, then use the following query :-

SELECT * FROM CUSTOMERS;

This would produce the following result :-




No comments:

Post a Comment