bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

SQL WHERE Keyword

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind SQL WHERE Keyword?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ * FROM Customers
3Order

Put the learning moves in the order that makes the concept easiest to apply.

SQL requires single quotes around text values (most database systems will also allow double quotes).
The following SQL statement selects all the customers from "Mexico" in the "Customers" table:
The WHERE command filters a result set to include only records that fulfill a specified condition.

Select

The WHERE command filters a result set to include only records that fulfill a specified condition.

The following SQL statement selects all the customers from "Mexico" in the "Customers" table:

Example

SELECT * FROM Customers

WHERE Country='Mexico';

SQL requires single quotes around text values (most database systems will also allow double quotes).

However, numeric fields should not be enclosed in quotes:

Example

SELECT * FROM Customers

WHERE CustomerID=1;

Note

The WHERE clause is not only used in SELECT statement, it is also used in UPDATE, DELETE statement, etc.!

The following operators can be used in the WHERE clause:

OperatorDescription
=Equal
<>Not equal. Note: In some versions of SQL this operator may be written as !=
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
BETWEENBetween a certain range
LIKESearch for a pattern
INTo specify multiple possible values for a column

Previous

SQL VIEW Keyword

Next

MySQL Functions