Home > Database > Mysql Tutorial > MySQL语句之or/and

MySQL语句之or/and

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:20:32
Original
1063 people have browsed it

在where中可以包含任意数目的and和or操作符,在没有任何其他符号的时候,例如括号,SQL会首先执行and条件,然后才执行or语句 eg. select * from table from id=1 or id=2 and price=10; 这条语句默认执行的是id=2并且price大于等于10的,或者是id=1。 如果加

在where中可以包含任意数目的and和or操作符,在没有任何其他符号的时候,例如括号,SQL会首先执行and条件,然后才执行or语句

eg.    select * from table from id=1 or id=2 and price>=10;

这条语句默认执行的是id=2并且price大于等于10的,或者是id=1。

如果加上括号:select * from table from (id=1 or id=2) and price>=10;

则这条语句执行的是id=1或id=2,并且price大于等于10。

Related labels:
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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template