Step 1: Select rows where 'athlete' is 'michael phelps'.
| medal_count |
date |
athlete |
nation |
sport |
record_medal_event |
| 1 |
1896-04-06 |
james connolly |
united states |
athletics |
triple jump g |
| 1 |
1896-04-06 |
alexandre tuffère |
france |
athletics |
triple jump s |
| 1 |
1896-04-06 |
ioannis persakis |
greece |
athletics |
triple jump b |
| 1 |
1896-04-06 |
robert garrett |
united states |
athletics |
discus g |
| 1 |
1896-04-06 |
panagiotis paraskevopoulos |
greece |
athletics |
discus s |
| 1 |
1896-04-06 |
sotirios versis |
greece |
athletics |
discus b |
| 2 |
1896-04-07 |
robert garrett |
united states |
athletics |
long jump s |
| 2 |
1896-04-07 |
james connolly |
united states |
athletics |
long jump b |
| 3 |
1896-04-07 |
robert garrett |
united states |
athletics |
shot put g |
| 3 |
1896-04-09 |
carl schuhmann |
germany |
gymnastics |
vault g |
| 3 |
1896-04-09 |
hermann weingärtner |
germany |
gymnastics |
vault b |
| 4 |
1896-04-09 |
hermann weingärtner |
germany |
gymnastics |
pommel horse s |
| 5 |
1896-04-09 |
hermann weingärtner |
germany |
gymnastics |
rings s |
| 6 |
1896-04-09 |
hermann weingärtner |
germany |
gymnastics |
horizontal bar g |
| 6 |
1900-07-16 |
robert garrett |
united states |
athletics |
standing triple jump b |
| 6 |
1904-09-03 |
ray ewry |
united states |
athletics |
standing triple jump g |
| 7 |
1908-07-20 |
ray ewry |
united states |
athletics |
standing long jump g |
| 8 |
1908-07-23 |
ray ewry |
united states |
athletics |
standing high jump g |
| 8 |
1920-07-29 |
carl osburn |
united states |
shooting |
team 300 m / 600 m military rifle , prone g |
| 9 |
1920-07-30 |
carl osburn |
united states |
shooting |
300 m military rifle , standing g |
| 10 |
1920-07-31 |
carl osburn |
united states |
shooting |
team free rifle g |
| 11 |
1924-06-27 |
carl osburn |
united states |
shooting |
600 m free rifle s |
| 11 |
1928-08-03 |
paavo nurmi |
finland |
athletics |
5000 m s |
| 12 |
1928-08-04 |
paavo nurmi |
finland |
athletics |
3000 m steeplechase s |
| 12 |
1960-09-02 |
edoardo mangiarotti |
italy |
fencing |
team foil s |
| 13 |
1960-09-09 |
edoardo mangiarotti |
italy |
fencing |
team épée g |
| 13 |
1964-10-21 |
larisa latynina |
soviet union |
gymnastics |
team g |
| 14 |
1964-10-21 |
larisa latynina |
soviet union |
gymnastics |
all - around s |
| 15 |
1964-10-22 |
larisa latynina |
soviet union |
gymnastics |
vault s |
| 16 |
1964-10-22 |
larisa latynina |
soviet union |
gymnastics |
uneven bars b |
| 17 |
1964-10-23 |
larisa latynina |
soviet union |
gymnastics |
balance beam b |
| 18 |
1964-10-23 |
larisa latynina |
soviet union |
gymnastics |
floor exercise g |
| 18 |
2012-07-31 |
michael phelps |
united states |
swimming |
200 m butterfly s |
| 19 |
2012-07-31 |
michael phelps |
united states |
swimming |
4 x 200 m freestyle g |
| 20 |
2012-08-02 |
michael phelps |
united states |
swimming |
200 m individual medley g |
| 21 |
2012-08-03 |
michael phelps |
united states |
swimming |
100 m butterfly g |
| 22 |
2012-08-04 |
michael phelps |
united states |
swimming |
4 100 m medley relay g |
Step 2: Extract the sum of 'medal_count' from the selected rows then add column 'phelps_medals' to the existing table.
| medal_count |
date |
athlete |
nation |
sport |
record_medal_event |
| 18 |
2012-07-31 |
michael phelps |
united states |
swimming |
200 m butterfly s |
| 19 |
2012-07-31 |
michael phelps |
united states |
swimming |
4 x 200 m freestyle g |
| 20 |
2012-08-02 |
michael phelps |
united states |
swimming |
200 m individual medley g |
| 21 |
2012-08-03 |
michael phelps |
united states |
swimming |
100 m butterfly g |
| 22 |
2012-08-04 |
michael phelps |
united states |
swimming |
4 100 m medley relay g |
Step 3: Select rows where 'athlete' is 'larisa latynina'.
| medal_count |
date |
athlete |
nation |
sport |
record_medal_event |
phelps_medals |
| 18 |
2012-07-31 |
michael phelps |
united states |
swimming |
200 m butterfly s |
100 |
| 19 |
2012-07-31 |
michael phelps |
united states |
swimming |
4 x 200 m freestyle g |
100 |
| 20 |
2012-08-02 |
michael phelps |
united states |
swimming |
200 m individual medley g |
100 |
| 21 |
2012-08-03 |
michael phelps |
united states |
swimming |
100 m butterfly g |
100 |
| 22 |
2012-08-04 |
michael phelps |
united states |
swimming |
4 100 m medley relay g |
100 |
Step 4: Extract the sum of 'medal_count' from the selected rows then add column 'latynina_medals' to the existing table.
| medal_count |
date |
athlete |
nation |
sport |
record_medal_event |
phelps_medals |
Step 5: Use a `CASE` statement to return TRUE if 'phelps_medals' is greater than 'latynina_medals', otherwise return FALSE.
| medal_count |
date |
athlete |
nation |
sport |
record_medal_event |
phelps_medals |
latynina_medals |
| None |
None |
None |
None |
None |
None |
None |
None |
| medal_count |
date |
athlete |
nation |
sport |
record_medal_event |
phelps_medals |
latynina_medals |
phelps_greater_than_latynina |
| None |
None |
None |
None |
None |
None |
None |
None |
FALSE |