Step 1: Select rows where 'res' is 'win'.
res |
record |
opponent |
method |
event |
round |
time |
loss |
7 - 6 - 1 |
kimo leopoldo |
tko (broken toe) |
9999-01-01 |
9999-01-01 |
1:55 |
loss |
7 - 5 - 1 |
marcelo tigre |
tko (punches) |
2001-01-01 |
9999-01-01 |
1:34 |
win |
7 - 4 - 1 |
osami shibuya |
decision (unanimous) |
2001-01-01 |
9999-01-03 |
5:00 |
win |
6 - 4 - 1 |
kengo watanabe |
ko (punches) |
9999-01-01 |
9999-01-01 |
3:23 |
loss |
5 - 4 - 1 |
jeff monson |
decision |
9999-01-01 |
9999-01-02 |
5:00 |
loss |
5 - 3 - 1 |
gan mcgee |
submission (strikes) |
9999-01-01 |
9999-01-01 |
4:38 |
win |
5 - 2 - 1 |
joe campanella |
tko |
9999-01-01 |
9999-01-01 |
0:18 |
loss |
4 - 2 - 1 |
borislav jeliazkov |
submission (rear naked choke) |
1999-01-01 |
9999-01-01 |
2:23 |
draw |
4 - 1 - 1 |
ron waterman |
draw |
9999-01-22 |
9999-01-03 |
5:00 |
loss |
4 - 1 |
tsuyoshi kohsaka |
tko (corner stoppage) |
9999-01-21 |
9999-01-02 |
5:00 |
win |
4 - 0 |
mark tullius |
submission (strikes) |
9999-09-01 |
9999-01-01 |
6:58 |
win |
3 - 0 |
eugene jackson |
submission (rear naked choke) |
9999-01-01 |
9999-01-01 |
9:49 |
win |
2 - 0 |
david ross |
tko |
9999-01-01 |
9999-01-01 |
5:36 |
win |
1 - 0 |
paul devich |
tko |
9999-01-01 |
9999-01-01 |
1:20 |
Step 2: Count the number of rows from the previous step and add column 'win_count' to the existing table.
res |
record |
opponent |
method |
event |
round |
time |
win |
7 - 4 - 1 |
osami shibuya |
decision (unanimous) |
2001-01-01 |
9999-01-03 |
5:00 |
win |
6 - 4 - 1 |
kengo watanabe |
ko (punches) |
9999-01-01 |
9999-01-01 |
3:23 |
win |
5 - 2 - 1 |
joe campanella |
tko |
9999-01-01 |
9999-01-01 |
0:18 |
win |
4 - 0 |
mark tullius |
submission (strikes) |
9999-09-01 |
9999-01-01 |
6:58 |
win |
3 - 0 |
eugene jackson |
submission (rear naked choke) |
9999-01-01 |
9999-01-01 |
9:49 |
win |
2 - 0 |
david ross |
tko |
9999-01-01 |
9999-01-01 |
5:36 |
win |
1 - 0 |
paul devich |
tko |
9999-01-01 |
9999-01-01 |
1:20 |
Step 3: Select rows where 'res' is 'loss'.
res |
record |
opponent |
method |
event |
round |
time |
win_count |
win |
7 - 4 - 1 |
osami shibuya |
decision (unanimous) |
2001-01-01 |
9999-01-03 |
5:00 |
7 |
win |
6 - 4 - 1 |
kengo watanabe |
ko (punches) |
9999-01-01 |
9999-01-01 |
3:23 |
7 |
win |
5 - 2 - 1 |
joe campanella |
tko |
9999-01-01 |
9999-01-01 |
0:18 |
7 |
win |
4 - 0 |
mark tullius |
submission (strikes) |
9999-09-01 |
9999-01-01 |
6:58 |
7 |
win |
3 - 0 |
eugene jackson |
submission (rear naked choke) |
9999-01-01 |
9999-01-01 |
9:49 |
7 |
win |
2 - 0 |
david ross |
tko |
9999-01-01 |
9999-01-01 |
5:36 |
7 |
win |
1 - 0 |
paul devich |
tko |
9999-01-01 |
9999-01-01 |
1:20 |
7 |
Step 4: Count the number of rows from the previous step and add column 'loss_count' to the existing table.
res |
record |
opponent |
method |
event |
round |
time |
win_count |
Step 5: Use a `CASE` statement to return TRUE if the value in 'win_count' is less than the value in 'loss_count', otherwise return FALSE.
res |
record |
opponent |
method |
event |
round |
time |
win_count |
loss_count |
res |
record |
opponent |
method |
event |
round |
time |
win_count |
loss_count |
win_loss_comparison |