AND/OR/NOT queries
applicationA software program that allows a user to perform a specific task. such as Microsoft Access use queryA search or question performed inside a database. language to narrow down search results. A query can look at more than one field.
Reg. number | Make | Model | Date registered | Price | Taxed |
R623 PHM | Ford | Fiesta | 010198 | 6800 | Y |
P887 LHW | Rover | 200 | 010397 | 7500 | Y |
X842 PLD | Ford | Mondeo | 010196 | 8100 | N |
P812 WHJ | Peugeot | 406 | 010996 | 7000 | N |
T419 PCP | Citroen | C4 | 010999 | 6000 | Y |
Reg. number | R623 PHM |
---|---|
Make | Ford |
Model | Fiesta |
Date registered | 010198 |
Price | 6800 |
Taxed | Y |
Reg. number | P887 LHW |
---|---|
Make | Rover |
Model | 200 |
Date registered | 010397 |
Price | 7500 |
Taxed | Y |
Reg. number | X842 PLD |
---|---|
Make | Ford |
Model | Mondeo |
Date registered | 010196 |
Price | 8100 |
Taxed | N |
Reg. number | P812 WHJ |
---|---|
Make | Peugeot |
Model | 406 |
Date registered | 010996 |
Price | 7000 |
Taxed | N |
Reg. number | T419 PCP |
---|---|
Make | Citroen |
Model | C4 |
Date registered | 010999 |
Price | 6000 |
Taxed | Y |
This is a list of common terms used in query language with example usage based on the table:
- AND - use to find all records where the make is a Ford AND the price is less than 8000. This would return the Fiesta but not the Mondeo.
- OR - use to find all records where the make is a Ford OR Rover. This would only return the Ford Fiesta, the Ford Mondeo and the Rover 200.
- NOT - use to find all records where the make is NOT Citroen. This would return all records except the Citroen C4.
In query language, these examples would look similar to this:
- [Make] = "Ford" AND [Price] < 8000
- [Make] = "Ford" OR [Make] = "Rover"
- [Make] = NOT "Citroen"