1. Even if WHERE
the clause appears at the end of the statement, MySQL will first use WHERE
the expression in the clause to select matching rows. It selects the row record with the job title as Sales Representative.
2. Usage:
SELECT lastname, firstname, jobtitle FROM employees WHERE jobtitle = 'Sales Rep';//选择为jobtitle为
Sales Rep的行
或:
SELECT lastname, firstname, jobtitle FROM employees WHERE jobtitle = 'Sales Rep' AND officeCode = 1//
选择为jobtitle为
Sales Rep的行且officeCode为1行
3.可用操作符:
= |
Equals, it can be used with almost any data type. |
<> or != |
not equal to |
< |
Less than, usually using numeric and date/time data types. |
> |
more than the, |
<= |
less than or equal to |
>= |
greater than or equal to |
example:
SELECT
lastname, firstname, jobtitle
FROM
employees
WHERE
jobtitle <> 'Sales Rep';//使用不等于