MySQL Search: WHERE multiple conditions

Source: Internet
Author: User

Where you can search by multiple criteria.

The Products table is as follows:



a where is searched with and after two conditions and three conditions:




b use or to search for multiple conditions



C This is a bit of a point, find out that the price of 1002 or 1003 produced by vend_id is more than 10 products, here need to use and and or combination:


However, from the above results, this output is not correct, because and is higher than or priority, so the meaning of this statement changed, to retrieve all vend_id=1002 products, as well as vend_id=1003 and price greater than 10 of the product, so need to use () to rewrite this sentence:



D uses in to describe multiple search values, which are similar in function to or, but with multiple values, the use of in-time syntax is more intuitive



The e not operator negates the condition that is followed:


In MySQL, the not can be used to take back in, between, and exists, unlike other DBMS systems.

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.