Use this space to put some text. Update this text in HTML

468x60 banner ad

Advertise with Us

Powered by Blogger.
Showing posts with label sql select query. Show all posts
Showing posts with label sql select query. Show all posts

Tuesday, 23 February 2016

sql-select-query

SQL Select Query

SQL SELECT statement is used to retrieve the data from a table in the database. 
sql select query retrieve data from particular column or all columns in the table.  
the query result is called result-sets.

Syntax of SQL SELECT Statement:

SELECT Column1, Column2, Column3, ColumnN
FROM Table_Name

Here, column1, column2...are the fields of a table whose values you want to fetch. 
  • Table_Name through which data is retrieved. 
  • columns which you want to retrieved the data from one or more column.

  Example:

Consider the EMPLOYEE table having the following records:








If you want to fetch all the fields of EMPLOYEE table, then use the following query:

SELECT * FROM Employee












If you want to fetch Employee_id, First_name, Salary fields of EMPLOYEE table, then use the following query:

SELECT Employee_id, First_name, Salary 
FROM Employee



 

WHERE Clause in SELECT Statement:

The WHERE Clause is used to retrieve the specific information on the basis of condition. the conditional operation give you the exact result whatever you wants.   

For example, when you want to see the information about Employee whose salary not greater than 700000. Retrieving information about all the Employee would increase the processing time for the query.

Example

SELECT First_name, salary
FROM employee
WHERE Salary > 700000;

Result