MySQL: AND Operator

Profile picture for user arilio666

In writing conditions there comes a point where the conditions based on a single term have another need to match it and this is where we will be using the AND operator.

AND operator is an operator which performs the additional condition paired up with the WHERE clause and both need to match in the case of AND operator.

Syntax

SELECT * from tablename WHERE condition1 (comparison) condition2 AND condition3 (comparison) condition4

Let us see this in a real-time example where will be using this customers table for example:

Example

select * from customers where birth_date > '1990-01-01' and points > 1000

So here I am doing a simple operation using AND operator as we can see from the table I'm fetching people who are born after 1990 which we can say greater than that year 1990 with the help of AND operator I further wanted another true condition where people born after the 1990 year also having points greater than 1000.

Tags