Query

3
Computer studies Year 10 Topic : Query 1. A search is when the computer looks for data meeting certain conditions. To do this, you use a query which is basically a list of the things you want to the computer to look for. 2. Simple queries tell the database to look for records that meet just one condition. SIMPLE QUERIES This could be to list all the records of workers whose salary value equals $400 the query is : Value = $400 Below is the list of simple conditions of queries : = Finds values equal to a certain amount. < Finds values less than the amount specified. > Finds values greater than the amount specified. <> Finds values not equal to the amount specified. <= Finds values less than or equal to the amount specified. >= Finds values greater than or equal to the amount specified. 3. You can also do wildcard searches. These are where you are only know part of the value to search for. Example : you may be remember that a worker s last name begins with Be but cannot remember the full name. Prepared by : Cikgu fizah Phd Page 1

Transcript of Query

Page 1: Query

Computer studies Year 10

Topic : Query

1. A search is when the computer looks for data meeting certain conditions. To do this, you use a query – which is basically a list of the things you want to the computer to look for.

2. Simple queries tell the database to look for records that meet just one condition.

SIMPLE QUERIESThis could be to list all the records of workers whose salary value equals $400 – the query is :

Value = $400

Below is the list of simple conditions of queries :

= Finds values equal to a certain amount.< Finds values less than the amount specified.> Finds values greater than the amount specified.<> Finds values not equal to the amount specified.<= Finds values less than or equal to the amount

specified.>= Finds values greater than or equal to the amount

specified.

3. You can also do wildcard searches. These are where you are only know part of the value to search for.Example : you may be remember that a worker’s last name begins with “Be” but cannot remember the full name.

WILDCARD SEARCHESUse * to stand for anything in the query.

Last Name = “Be”,The asterisk can stand for anything (or nothing). So the results will

Prepared by : Cikgu fizah Phd Page 1

Page 2: Query

Computer studies Year 10

include Best, Bentley and Beech, but not Batley or Boris.4. You can also do complex searches – these are when you use

AND, OR, and NOT (boolean logic )to find records that meet more than one conditon. They’re used in expressions which can only be either true or false.

COMPLEX SEARCHESThese search for data meeting more than one condition. You might

need to find all the workers called either Boris or Beryl. So you seach criteria would be:

First name = “Boris” OR “Beryl”Or may be you need to find worker called Boris who also have a

salary value over $500. In this case the search is “First name = “Boris” AND value >$500

Or may be you’re looking for people not called Boris whose salary value is not over $200. (you never know...)

You could use:NOT(First name = “Boris”) And Value <=$200.

Prepared by : Cikgu fizah Phd Page 2