Home > Database > Mysql Tutorial > Commonly used basic operation syntax of mysql (5) - simple conditional query of data [command line mode]

Commonly used basic operation syntax of mysql (5) - simple conditional query of data [command line mode]

黄舟
Release: 2017-03-03 14:06:41
Original
1553 people have browsed it

1. Single condition query: select field name from tablename where condition;


##2. Simple multi-condition query, use && or between and, etc.:


3. is null and is not null queries. Please note that null is not an empty string and is not 0:



#4. In and not in queries are equivalent to using or to connect the set elements behind in. Note that if there is null in the collection followed by in, it will not affect the result, but if there is null in the collection followed by not in, no results will be investigated, and null cannot be detected by not in:


5. Like fuzzy query (not only applicable to strings):

The query starts or ends with a certain character or several characters or contains in the middle: %


If you want the opposite logic, you can use not. There are two slightly different ways of writing:


It’s okay Use _ (underscore) as a placeholder. For example, the following examples indicate that the third letter is s (two underscores) and the second letter is s (one underscore):


Not can also be used here.


The above is the content of mysql common basic operation syntax (5) - simple conditional query of data [command line mode]. For more related content, please pay attention to the PHP Chinese website (www.php.cn )!



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template