SQL AND Keyword
The AND keyword in SQL is used in the WHERE clause to filter records based on multiple conditions. It returns only the rows where all conditions are true.
SQL AND Syntax
SQL
x
1
SELECT column1, column2, ...
2
FROM table_name
3
WHERE condition1 AND condition2;
SQL AND Example with Patients Table
This query selects all patients whose gender is 'F'
and who were born after '1990-01-01
. This query returns only the records where both conditions are true: the patient must be female (gender = 'F'
) and must have a date of birth later than January 1, 1990 (dob > '1990-01-01'
).
SQL
1
1
SELECT * FROM Patients
2
WHERE gender = 'F' AND dob > '1990-01-01';
