Problem: Use Comparisons and Logic

You want to find all the pets that are either dogs or cats, but only if they’re younger than 4 years old.

💡 Hint: You’ll need to combine multiple conditions using both OR and AND. Be sure to group the OR condition with parentheses so that the logic is applied correctly.

Use the table below to help write a query that gives you just those results.

The pets table

ID

Name

Type

Age

1

Coco

dog

5

2

Luna

cat

3

3

Goldie

fish

1

Use the above table to write your query.

Problem: Use Comparisons and Logic

You want to find all the pets that are either dogs or cats, but only if they’re younger than 4 years old.

💡 Hint: You’ll need to combine multiple conditions using both OR and AND. Be sure to group the OR condition with parentheses so that the logic is applied correctly.

Use the table below to help write a query that gives you just those results.

The pets table

ID

Name

Type

Age

1

Coco

dog

5

2

Luna

cat

3

3

Goldie

fish

1

Use the above table to write your query.

MySQL
# Write your query here: