[MySQL] Filtering data

Source: Internet
Author: User

Tag: greater than or equal to MYSQ search validation order by database where SEL nbsp

Specifying search criteria using the WHERE clause of the SELECT statement

In the SELECT statement, the data is filtered according to the search criteria specified in the WHERE clause, given after the table name

SELECT column name 1, column name 2 from table name WHERE condition;

Condition is a specific value of the data in the column

WHERE clause position

SELECT + from + WHERE + ORDER by

WHERE clause operator

Operator description

= equals

<> Not equal to

! = does not equal

< less than

<= less than or equal to

> Greater than

>= greater than or equal to

Between between the specified two values

Check individual values

SELECT column name 1, column name 2 from table name WHERE column name 1 operator (<,;, =) column data;

  

Mismatch check

SELECT column name 1, column name 2 from table name where column name 1 <> column value;

Range value Check

SELECT column name 1, column name 2 from table name WHERE column Name 1 between value 1 and value 2;

Null value Check

SELECT column name from table name WHERE column name is NULL;

  

Null and mismatched when you select a column that does not have a specific value by filtering, you may want to return a row that has a null value. However, no, because the unknown has a special meaning, the database does not know whether they match, so they are not returned when matching filtering or mismatched filtering.

Therefore, when filtering data, be sure to verify that the returned data does give a row with NULL in the filtered column.

[MySQL] Filtering data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.