Presentation is loading. Please wait.

Presentation is loading. Please wait.

Databases Searching and Sorting. SIMPLE search A SIMPLE search is when you use only ONE field to search the database. e.g.Searching a football database.

Similar presentations


Presentation on theme: "Databases Searching and Sorting. SIMPLE search A SIMPLE search is when you use only ONE field to search the database. e.g.Searching a football database."— Presentation transcript:

1 Databases Searching and Sorting

2 SIMPLE search A SIMPLE search is when you use only ONE field to search the database. e.g.Searching a football database to find all teams that play in Spain So you would use COUNTRY = “Spain” (only ONE field is used) TeamCountryStadiumColoursStar Player LiverpoolEnglandAnfieldRedGerrard Real MadridSpainBernabauWhiteVan Nistelrooy AC MilanItalySan SiroRed/ BlackKaka BarcelonaSpainNou CampRed/ BlueRonaldinho Bayern MuncihGermanyAllianzRedRiberry

3 COMPLEX search A complex search uses TWO OR MORE fields to find information So searching the same database would be as follows COUNTRY = “Spain” AND Colours = “White” TeamCountryStadiumColoursStar Player LiverpoolEnglandAnfieldRedGerrard Real MadridSpainBernabauWhiteVan Nistelrooy AC MilanItalySan SiroRed/ BlackKaka BarcelonaSpainNou CampRed/ BlueRonaldinho Bayern MuncihGermanyAllianzRedRiberry

4 Examples of Simple searches Eye Colour = “Blue” Country = “Italy” Language = “Spanish” Stays in = “Lochwinnoch” Anything that uses just ONE field in a database is a SIMPLE search

5 More SIMPLE searches If you have a numeric field then it is possible to search that in a slightly different way. Look at the extract from countries database CountryCapital CityCurrencyPopulation (millions) Language EgyptCairopound80.3Arabic IsraelJerusalemShekel6.4Hebrew LatviaRigaLats2.3Latvian JapanTokyoYen127.3Japanese BrazilBrasiliaReal190Portuguese PortugalLisbonEuro10.6Portuguese Since it is a numeric field we can treat the contents as a number therefore Population > 100 gives 2 countries Japan and Brazil

6 More COMPLEX searches Eye colour = “Blue” AND Hair Colour = “Brown” Town = “Johnstone” AND Primary = “Thorn” Currency = “Euro” AND Population > 20 million Cost < £1 AND Type = “drink” Height > 2m AND Right handed = “Yes” Resort = “Corfu” AND Cost < £400

7 SORTING a database Sorting a database involves using ONE or MORE fields and putting them in order. You can either sort ALPHABETICALLY (a-z or z-a) NUMERICAL (ascending or descending) YOU HAVE TO TELL THE DATABASE WHAT FIELD YOU ARE SORTING THOUGH

8 More SORTING NameHeight (m) Eye Colour Right Handed Jane1.6BlueNo Bill1.7HazelYes Bob2.4HazelNo Alice1.8GreenYes NameHeight (m) Eye Colour Right Handed Jane1.6BlueNo Bill1.7HazelYes Bob2.4HazelNo Alice1.8GreenYes Sorted using height field ascending

9 SUMMARY Do you know the difference between SIMPLE SEARCH And COMPLEX SEARCH Make sure you tell the database which FIELD or FIELDS you intend to search. Do you know the difference between Sort ascending or descending Numerical Sort and Alphabetical Sort


Download ppt "Databases Searching and Sorting. SIMPLE search A SIMPLE search is when you use only ONE field to search the database. e.g.Searching a football database."

Similar presentations


Ads by Google