Volunteer Appreciation Reward
Problem
Table: `Volunteers`
```text
+--------------+---------+
| Column Name | Type |
+--------------+---------+
| volunteer_id | int |
| full_name | varchar |
| base_hours | int |
+--------------+---------+
volunteer_id is the primary key for this table.
Each row holds a volunteer's ID, name, and the hours they logged this term.
```
A charity runs a quirky appreciation lottery. A volunteer earns a reward equal to `100%` of their base_hours **only if** their volunteer_id is **an odd number** **and** their full_name does **not** start with the letter `'T'`. Otherwise their reward is `0`.
Write a solution to compute each volunteer's `reward`.
Return the result table ordered by `volunteer_id` ascending.
Tables
Example rows — the live problem includes the full dataset.
| volunteer_id | full_name | base_hours |
|---|---|---|
| 2 | Tamar | 30 |
| 3 | Tobias | 38 |
| 7 | Aria | 74 |
Expected output
Your answer should return 5 rows with the columns volunteer_id, reward.
Starter code (SQL)
SELECT *
FROM Volunteers;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock