Query Commands

Query
A query is an operation, which will allow you to extract information from a table (or tables) given particular criteria. For example, you could search through a list for a stock item within a certain price range, or a person in a certain town.

Query Commands
When we search for information we don't always know the exact details of the data we want to view. To help us we can use a structured query language (SQL) which will allow us to select fields from a database and then enter a range of values using arithmetic operators like:

> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
= Equal to
<> Not equal to

Other words - eg. AND, OR and LIKE are also used to narrow a range.

Wildcard commands are useful when you are not sure of the exact spelling or how the information is stored. An asterisk, * placed at the end or beginning of the search criteria represents any letter. Suppose the police want to trace the owner of a white Audi with a registration number where K is the last letter. A search for Audi under Make of car, White under Colour and **K will pick out a narrow range of vehicle owners from the database at the DVLA.

If you are looking for a name in a database and you only know the first 2 letters, for example Je, then Je* could bring up Jennings, Jenkins, Jessop. If you know the exact name as it appears in the database then you can type in the whole name.

Contents: Databases

Skill Check: Databases