codescracker


sql

SQL Where



« Previous Tutorial Next Tutorial »


SQL WHERE clause is used to filter the records present in the table. Here is the general form of the WHERE clause in SQL:

SELECT column1, column2, columnN 
FROM table_name
WHERE [condition]

SQL WHERE Clause Example

Consider the table CUSTOMERS having the following records:

SQL Where

Following is an example which will fetch the following columns:

from the table CUSTOMERS where salary is greater than 85000.00:

SELECT ID, NAME, SALARY 
FROM CUSTOMERS
WHERE SALARY > 85000.00;

After querying the above SQL statements, you will get the following output:

SQL Where Query

Following is an example, which would fetch the following columns:

from the table CUSTOMERS for a customer with name 'Shubham Shrivastava'.

SELECT ID, NAME, SALARY 
FROM CUSTOMERS
WHERE NAME = 'Shubham Shrivastava';

After querying the above SQL statements, you will get the following output:

SQL Where clause

« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test