General
Purpose Packages
Automated
Systems
Commercial Data
Processing
Computer Systems
Hardware
Computer Systems
Software
Programming Course
Arrangements

Sorting Records in Databases

Database packages are extremely useful and good at storing, searching and sorting data, for example names and addresses, customer details, pupil test scores.

Database Structure

Even when databases files are large, containing millions of records, they are good at sorting through information very quickly. Sorting through database can either be:

  1. Simple or;
  2. Complex

 

 

 

What you have to do! - Simple Sorting

play
How to do Simple & Complex Sorting! Click to Go Larger Screen
  1. Using the FOOTBALL TEAM KITS database file, and; .
  2. Watch Video 2 .
  3. Use the information from the movie to answer the following questions in Exercise 2 of the General Section of your PROGRESS Grids
    1. Sort the database by stock number in ascending order.
    2. Write down the stock number of the teams who are first and last on the list.
    3. Sort the categories in in descending order. Write down the number of the last kit listed.
    4. Which kits have the greatest and least number in stock? Write down the stock number.

 

Mark off Exercise 2 in your Progress Grids

 

Simple sorts generally involve sorting on one field, price for example or pupils test scores, or stock level.

Often though its is useful to sort on two or more fields, especially when some of the fields contain duplicate data. For example, many people have share surnames or are sold at the same price, so how there is a problem of how to distinguish between people or different products.

 

What you have to do! - Complex Sorting

  1. Download the Paintings.fp7 Database and place in your Database folder.



  2. Watch the second half of Video 3 above to see how to complete Complex Sorts.
  3. Open the database file PAINTINGS and answer the following questions in Exercise 3 in the General section of your PROGRESS Grids.
    1. Sort by type and then seller code. Write down the 11th and 37th catalogue number listed.
    2. Sort by seller code and then by painting type. Notice the difference in this sort to the previous sort, although the same fields are used.
    3. Sort by seller code followed by painting title. The title should be sorted in descending order. Write down the catalogue number of the 9th record listed.
    4. Sort by reserve cost and then by painter surname. Finally the painter forename should be sorted so that all paintings by a particular artist are displayed together. Write down the catalogue number of the 5th and 25th paintings listed.
    5. Sort by catalogue number followed by the reserve price. Write down the 10th catalogue number listed.
    6. Sort by catalogue number followed by seller code. Write down the 10th catalogue number listed.
    7. Write down what you notice about the results of questions 5 and 6. Write down the reasons why these sorts behave in the way that they do.

 

Mark off Exercise 3 in your Progress Grids

 

What you should be able to do now!

 

Continue to Section 3: Searching Databases

 


 

 

 

 

Home | S1 Topics | S2 Topics
Computing Standard Grade | Info Systems Intermediate II | Info Systems Higher | Internet Safety
Log into Glow | School Website | Contact Us