Mysql WHERE

1. Even if WHEREthe clause appears at the end of the statement, MySQL will first use WHEREthe 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';//使用不等于

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324518234&siteId=291194637