Multiple conditions allow you to filter database records using two or more criteria. In Microsoft Access, you can combine conditions with AND, OR, NOT, and parentheses to retrieve the exact records you need.
Multiple conditions are two or more requirements used together in a query. They help you find records that match particular combinations of values.
| StudentID | StudentName | Course | Fees |
|---|---|---|---|
| 101 | Amit | ADCA | 10000 |
| 102 | Priya | Tally Prime | 4000 |
| 103 | Rahul | ADCA | 8000 |
| 104 | Neha | Web Development | 12000 |
| 105 | Ravi | Python | 6000 |
Suppose you want to find ADCA students whose fees are greater than 5000. You need two conditions:
SELECT *
FROM Students
WHERE Course = "ADCA"
AND Fees > 5000;
This query returns Amit and Rahul because both records satisfy the two conditions.
The AND operator returns records only when all specified conditions are true.
SELECT *
FROM Students
WHERE Course = "ADCA"
AND Fees > 5000;
This query displays ADCA students whose fees are greater than 5000.
SELECT *
FROM Students
WHERE Fees >= 5000
AND Fees <= 10000;
This query displays students whose fees are at least 5000 and at most 10000.
SELECT *
FROM Students
WHERE Course = "ADCA"
AND StudentName LIKE "A*";
In the default Access ANSI-89 wildcard syntax, this query finds students enrolled in ADCA whose names begin with A.
The OR operator returns records that satisfy at least one of the specified conditions.
SELECT *
FROM Students
WHERE Course = "ADCA"
OR Course = "Tally Prime";
This query displays students enrolled in ADCA or Tally Prime.
SELECT *
FROM Students
WHERE Fees < 5000
OR Fees > 10000;
This query returns students whose fees are below 5000 or above 10000.
SELECT *
FROM Students
WHERE StudentName = "Amit"
OR StudentName = "Priya";
This query returns records for Amit or Priya.
You can combine AND and OR in the same query to create more specific conditions.
SELECT *
FROM Students
WHERE Course = "ADCA"
OR Fees > 10000;
This query returns students who are enrolled in ADCA or whose fees are greater than 10000.
SELECT *
FROM Students
WHERE (Course = "ADCA" AND Fees > 5000)
OR Course = "Python";
This query returns:
Parentheses make it clear which conditions should be evaluated together.
You can create multiple conditions without writing SQL manually by using the query design grid.
"ADCA" in the Course field's Criteria row.>5000 in the Fees field's Criteria row.| Field | Course | Fees |
|---|---|---|
| Table | Students | Students |
| Show | ✓ | ✓ |
| Criteria | "ADCA" | >5000 |
| Or |
Because both conditions are in the same Criteria row, Access combines them using AND.
To find students enrolled in ADCA or Tally Prime, you can place the criteria on separate rows:
| Field | Course |
|---|---|
| Criteria | "ADCA" |
| Or | "Tally Prime" |
This arrangement returns records that match either course.
The NOT operator reverses a condition. It is useful when you want to exclude certain values.
SELECT *
FROM Students
WHERE NOT Course = "ADCA";
This query returns records where Course is not ADCA. Records with a Null Course value will not satisfy this condition either.
SELECT *
FROM Students
WHERE NOT (Fees BETWEEN 5000 AND 10000);
This query finds students whose fees fall outside the specified range, excluding records where Fees is Null.
Multiple conditions can also be used with Date/Time fields.
SELECT StudentName, AdmissionDate
FROM Students
WHERE AdmissionDate >= #1/1/2026#
AND AdmissionDate < #1/1/2027#;
This query finds admission dates from the start of January 1, 2026, up to but not including January 1, 2027. Using an exclusive upper boundary also works for date fields that contain times.
SELECT *
FROM Students
WHERE Course = "ADCA"
AND AdmissionDate >= #1/1/2026#
AND AdmissionDate < #1/1/2027#;
This query requires all three conditions to be satisfied: the course must be ADCA and the admission date must fall within 2026.
Create a table named Students with these fields:
Goal: Practice combining AND, OR, NOT, numeric criteria, text criteria, and date conditions.
1. Which operator requires all conditions to be true?
2. Which operator allows either condition to match?
3. What is the purpose of parentheses in complex conditions?