Step 1: Select rows where 'wins' is greater than 0.
| year |
class |
team |
points |
wins |
| 1959 |
125cc |
ducati |
2 |
0 |
| 1960 |
125cc |
mv agusta |
0 |
0 |
| 1960 |
250cc |
aermacchi |
2 |
0 |
| 1960 |
350cc |
norton |
0 |
0 |
| 1960 |
500cc |
norton |
0 |
0 |
| 1961 |
250cc |
aermacchi |
0 |
0 |
| 1961 |
500cc |
norton |
3 |
0 |
| 1962 |
125cc |
honda |
2 |
0 |
| 1962 |
250cc |
honda |
8 |
0 |
| 1963 |
50cc |
kreidler |
9 |
0 |
| 1963 |
350cc |
norton |
0 |
0 |
| 1964 |
250cc |
paton |
6 |
0 |
| 1965 |
250cc |
aermacchi |
1 |
0 |
| 1965 |
350cc |
aermacchi |
0 |
0 |
| 1966 |
250cc |
aermacchi |
4 |
0 |
| 1966 |
350cc |
aermacchi |
11 |
0 |
| 1967 |
250cc |
aermacchi |
0 |
0 |
| 1967 |
350cc |
aermacchi |
11 |
0 |
| 1968 |
500cc |
linto |
9 |
0 |
| 1969 |
350cc |
aermacchi |
0 |
0 |
| 1969 |
500cc |
linto |
15 |
1 |
| 1970 |
250cc |
aermacchi |
4 |
0 |
| 1970 |
500cc |
linto |
30 |
0 |
| 1971 |
125cc |
derbi |
4 |
0 |
| 1971 |
250cc |
suzuki |
0 |
0 |
| 1971 |
500cc |
linto |
29 |
1 |
| 1971 |
500cc |
mv agusta |
29 |
1 |
| 1972 |
350cc |
mv agusta |
4 |
0 |
| 1972 |
500cc |
mv agusta |
87 |
1 |
Step 2: Calculate the average of the 'points' column for the selected rows and add column 'avg_points' to the existing table.
| year |
class |
team |
points |
wins |
| 1969 |
500cc |
linto |
15 |
1 |
| 1971 |
500cc |
linto |
29 |
1 |
| 1971 |
500cc |
mv agusta |
29 |
1 |
| 1972 |
500cc |
mv agusta |
87 |
1 |
Step 3: Select rows where 'avg_points' is equal to or greater than 40.
| year |
class |
team |
points |
wins |
avg_points |
| 1969 |
500cc |
linto |
15 |
1 |
40.0 |
| 1971 |
500cc |
linto |
29 |
1 |
40.0 |
| 1971 |
500cc |
mv agusta |
29 |
1 |
40.0 |
| 1972 |
500cc |
mv agusta |
87 |
1 |
40.0 |
Step 4: Use a `CASE` statement to return TRUE if the number of rows is equal to or greater than 1, otherwise return FALSE.
| year |
class |
team |
points |
wins |
avg_points |
| 1969 |
500cc |
linto |
15 |
1 |
40.0 |
| 1971 |
500cc |
linto |
29 |
1 |
40.0 |
| 1971 |
500cc |
mv agusta |
29 |
1 |
40.0 |
| 1972 |
500cc |
mv agusta |
87 |
1 |
40.0 |
Prediction: TRUE