Home > Article > Daily Programming > The rules of and, or and as in mysql
The rules of AND, OR and AS in MySQL: AND: true when all conditions are true, and the priority is higher than OR; OR: true when one condition is true, and the priority is lower than AND; AS: for selection The column designation alias is followed by the column alias.
Rules for AND, OR and AS in MySQL
AND
condition1 AND condition2
OR
condition1 OR condition2
AS
SELECT column_name AS column_alias
Rules
For example:
<code>SELECT * FROM table_name WHERE (column1 = value1 OR column2 = value2) AND column3 = value3 AS result_alias;</code>
In this query:
The operator combines
column1 and The conditions of
column2 are combined together. The
operator combines the conditions of the
OR operator with the conditions of
column3. The
keyword specifies an alias for the query result as
result_alias.
The above is the detailed content of The rules of and, or and as in mysql. For more information, please follow other related articles on the PHP Chinese website!