SQL SELECT statement using WHERE clause

Posted by tagicon_admin | July 31, 2015 | in : SQL

When we need specific information or data or row from the database then we can use WHERE clause to restrict or specific data. A WHERE clause directly follows the FROM clause and it contains a condition that must be met. This clause can compare values in function, literal, arithmetic expressions and columns.

Syntex of WHERE clause:
=======================

SELECT * |{[DISTINCT] column/expression [alias]…}
FROM table
[WHERE condition(s)];

 

I am sharing some example of WHERE clause below:
–>We need to display all information for employee number 176.

Above query will make the following result:

–> Retrieve first name, job id, manager id, salary whoes earn more than $1500.

Above query will make the following result:

 

 

–> Retrieve job id, last name, hire date, email whose salary between $10000 and $14000.

Above query will make the following result:

 

 

–>Display the job id, first name, salary, email of Ozer and Abel.

Above query will make the following result:

–>Retrieve last name, phone number, job id who were hired in 2005.

We have used hire date from 2001-2008 within our database. So above query will show only 2005 related data and make the following result:

 

Related Posts

Leave a Reply