# Condition Query
/ *
SELECT
query list
from
table
where filters;
sequence: from table name -> Filter -> SELECT field
* /
# conditional operator
# > < = =! ( <> ) > = <=
# Logic operation symbol
# && || ^ ( the AND , OR , the nOT )
# fuzzy query
# the LIKE % , _, Escape
# bewteen the AND inclusive, the sequence can not be reversed
# the IN value must be the exact value (not write wildcards)
# the iS NULL Equal number can not determine the value NULL
# IS the NOT NULL does not equal NULL value can not be determined
# security equal (equal sign) <=> either determine value, but also to determine NULL
the USE `myemployees`;
# query wages higher than 12,000.
The SELECT
*
the FROM
`employees`
the WHERE salary > 12000 ;
employee # inquiry number is not 90 department name and department number of employees
the SELECT
` last_name`,
`department_id`
the FROM
` employees`
the WHERE `department_id` <> 90 ;
# query to pay 10,000 staff were between 20,000 salary and bonuses
the SELECT
`last_name`,
` salary`,
`commission_pct`
the FROM
employees` `
the WHERE ` salary` > 10000
the AND `salary` < 20000 ;
# query sector number is less than 90 or greater than 110, greater than or employee payroll information 15000
the SELECT
*
the FROM
` employees`
the WHERE `department_id` < 90
OR ` department_id` > 110
OR `salary` > 15000 ;
the SELECT
*
the FROM
` employees`
the WHERE the NOT (
`department_id` > = 90
the AND ` department_id` <= 110
)
ORsalary` ` > of 15,000 ;
# query employee information employee name contains the letter a
# LIKE in % is 0 - the n-number of any characters, _ is an arbitrary character, you can use the \ escape character, you can also specify the character transfer
the SELECT
*
the FROM
`employees`
the WHERE ` last_name` the LIKE ' % a% ' ;
# inquiry staff were second character is _ employee information
#ESCAPE the escape character is defined as the $
the SELECT
*
the FROM
`employees`
the WHERE ` last_name` the LIKE ' _ % _ $ ' the ESCAPE ' $ ' ;