Computer Science Grade 4 20 min

Filtering Data: Finding Just What You Need

Use filters to narrow down search results and find only the records that meet specific criteria.

Tutorial Preview

1

Introduction & Learning Objectives

Learning Objectives Define 'data filtering' using their own words. Identify a condition needed to filter a simple dataset. Apply a single filter to a list of data to find matching items. Apply a filter with two conditions (using 'AND') to a list of data. Explain why filtering is a useful tool for organizing information. Predict the results of a given filter on a small dataset. Create a simple filter rule to solve a problem. Ever tried to find your favorite blue crayon in a giant box of 100 crayons? 🖍️ Filtering is like having a magic helper that instantly hides all the colors you don't want! Today, we are going to be Database Detectives! We will learn a computer science superpower called 'filtering'. This superpower helps us search throu...
2

Key Concepts & Vocabulary

TermDefinitionExample DataAny piece of information, like a name, a number, or a color.In a list of superheroes, 'Spider-Man', 'Super Strong', and the number '10' are all pieces of data. DatasetA collection or group of data that is organized together, usually like a chart or a list.A list of all the students in your class with their names, ages, and favorite colors. FilterA rule you give the computer to hide information you don't want and only show the information you do want.In a list of animals, you use a filter to 'Show only the animals that can fly'. ConditionThe specific part of a filter rule that must be true for the data to be shown.In the filter 'Show all pets where Type is Dog', the condition is 'Type is Dog'. Column...
3

Core Syntax & Patterns

The 'Equals' Filter SHOW IF [Column] == [Value] Use this when you are looking for an exact match. The '==' means 'is exactly the same as'. For example, finding all players on the 'Blue Team'. The 'Greater Than' Filter SHOW IF [Column] > [Value] Use this with numbers when you want to find data that is bigger than a certain value. For example, finding all video games with a score 'greater than' 90. The 'AND' Filter SHOW IF [Condition 1] AND [Condition 2] Use this when you need two (or more) things to be true at the same time. It makes your search very specific. For example, finding a shirt that is 'blue' AND 'size medium'.

4 more steps in this tutorial

Sign up free to access the complete tutorial with worked examples and practice.

Sign Up Free to Continue

Sample Practice Questions

Challenging
A game has characters with a 'class' and 'level'. You want to find all characters that are 'level' 10 or higher, AND are either a 'Knight' OR a 'Wizard'. Which character would NOT appear in your filtered list?
A.level 12 Knight
B.level 15 Archer
C.level 10 Wizard
D.level 20 Knight
Challenging
A database of pets contains: 1. {name: 'Spot', type: 'Dog', age: 3}, 2. {name: 'Whiskers', type: 'Cat', age: 5}, 3. {name: 'Fido', type: 'Dog', age: 5}, 4. {name: 'Bubbles', type: 'Fish', age: 1}. After filtering, you only see {name: 'Fido', type: 'Dog', age: 5}. What were the filter rules?
A.type is 'Dog'
B.age is 5
C.type is 'Dog' OR age is 5
D.type is 'Dog' AND age is 5
Challenging
Your friend has a variable called 'max_price' set to $15. You have the same variable 'max_price' set to $25. If you both run a filter on the same list of items for 'price < max_price', what will happen?
A.You will likely see more items or the same number of items as your friend
B.Your friend will likely see more items or the same number of items as you
C.You will both see the exact same list of items
D.The filter will cause an error because the variable is different

Want to practice and check your answers?

Sign up to access all questions with instant feedback, explanations, and progress tracking.

Start Practicing Free

More from Database Detectives: Organizing Information Like a Pro

Ready to find your learning gaps?

Take a free diagnostic test and get a personalized learning plan in minutes.