Slides badge

Searching and Sorting databases

Starter task

  1. Circle one field
  2. Circle one record

Searching and sorting a database

  1. Circle one field
  2. Circle one record

Data types

  • What data type is most suitable for storing a person’s forename?
  • Why would we use text rather than a number to store a mobile phone number such as 07500 100 200?
  • What data type is most suitable for storing a date of birth?
  • What data type should we use to store a car registration number?

Learning Intentions

  • Understand what searching and sorting are and why they are important for databases
  • Understand how to search a database
  • Understand how to sort a database

Success Criteria

  • I can design a search and/or sort query
  • I can explain the benefits of designing a query

What is a database?

  • A database is used when a large amount of information must be stored in some sort of order so that it can be accessed easily and quickly.

  • A database is a structured collection of similar information which you can search through. You can store a database manually or electronically.

Searching and sorting

  • We mentioned the way in which data is stored in a database is a structured collection of information about one topic.
  • Databases are designed to be easily searched and easily sorted.
  • When we are searching, we are trying to find something.
  • When we are sorting, we are putting the database in an order.
  • When we are carrying out a search or a sort we are querying the database.

Searching a database

  • When we are searching a database, we are trying to find something.
  • This is an important feature of databases, especially as they get bigger and bigger.
  • Thinking about searching databases, what do you think happens when you search Google or Bing?
  • When you perform a search on the web, you are searching a giant database that the search engine holds.

Sorting a database

  • Sorting the database means putting it in a different order.
  • We call the order either ascending or descending.
  • Again, thinking about sorting databases, what do you think happens to the order of the data coming from a Google search?
  • When you perform a search on the web, Google will sort the data coming out in an order which puts the most relevant information first.

Sorting a database

  • Let’s assume we have a collection of information as shown in this graph. We can sort by ascending and descending order. Ascending means going from small to big whereas descending order means going from the biggest number to the smallest.

Searching and Sorting databases

  • Searching and sorting a database involves knowing what fields are needed, what the criteria is and what the sort order is.
  • Assume we have the BondCharacters table from the James Bond Top Trumps database as shown below:

Searching and Sorting databases

  • Find everyone who has 100 Strength and sort them by their Intelligence (going from small to big). Display the character’s name, strength, agility and intelligence. 
Fields CharacterName, Strength, Agility, Intelligence
Table BondCharacters
Criteria Strength = 100
Sort Order Intelligence ASCENDING

Searching and Sorting databases

  • Find everyone who has more than 30 Agility and sort them by the CharacterName (going from Z to A). Display the character’s name, strength, agility and intelligence and a picture. 
Fields
Table
Criteria
Sort Order

Searching and Sorting databases

  • Find everyone who has more than 30 Agility and sort them by the CharacterName (going from Z to A). Display the character’s name, strength, agility and intelligence and a picture. 
Fields CharacterName, Strength, Agility, Intelligence, Picture
Table BondCharacters
Criteria Agility > 30
Sort Order CharacterName DESCENDING
You can find your task on Google Classroom.
For this task you must open the James Bond characters database and use it to build queries.

Activity

Presentation Overview
Close
JB
Searching and sorting databases
© 2020 - 2024 J Balfour
14:39 | 29-04-2024
Join Live Session
Start Remote
Save Progress
Slideshow Outline
Presenter Mode
Widget Screen
Canvas Controls
Random Selector
Timer
Volume Meter
Binary Converter
Python Editor
Show Knox 90
Provide Feedback
Help
!
Keywords
    DragonDocs Management
    Random selector
    Sections
      Binary conversion
      Denary to binary conversion
      Binary to denary conversion
      Feedback 👍
      Accessibility

      Apply a filter:

      ×
      All slideshow files