WHERE Clause of a SELECT Statement

This section provides tutorial examples on how to use the WHERE clause to filter rows out of the base table in a SELECT statement.

As I mentioned earlier, the WHERE clause modifies the base table by filtering out rows of data that do not satisfy the specified conditions. Here is its syntax:

WHERE where_condition

where "where_condition" is a predicate operation that will result a true or false condition.

WHERE clause samples:

WHERE Salary <= 45000.00
WHERE Salary > 45000.00 AND Salary <= 65000.00
WHERE Dept IN ('Math','Chem')
WHERE (Dept = 'Math' OR Dept = 'Chem') AND Salary <= 45000.00
WHERE User.Dept_ID = Dept.ID

Last update: 2015.

Table of Contents

 About This Book

 Introduction of SQL

 MySQL Introduction and Installation

 Introduction of MySQL Programs

 Perl Programs and MySQL Servers

 PHP Programs and MySQL Servers

 Java Programs and MySQL Servers

 Datatypes and Data Literals

 Operations and Expressions

 Character Strings and Bit Strings

 Commonly Used Functions

 Table Column Types for Different Types of Values

 Using DDL to Create Tables and Indexes

 Using DML to Insert, Update and Delete Records

Using SELECT to Query Database

 SELECT Statements

 FROM Clause of a SELECT Statement

 JOIN -Operations to Join Two Tables

 JoinTable.sql - Example of Join Tables

WHERE Clause of a SELECT Statement

 GROUP BY Clause of a SELECT Statement

 ORDER BY Clause of a SELECT Statement

 Transaction Management and Isolation Levels

 Locks Used in MySQL

 Defining and Calling Stored Procedures

 Variables, Loops and Cursors Used in Stored Procedures

 Outdated Tutorials

 References

 PDF Printing Version