Step 1: Order the table by the difference between the 'last' and 'first' columns in ascending order.
name |
total |
first |
last |
highest_rank |
kotonishiki |
34 |
1990-09-01 |
1999-09-01 |
sekiwake |
kaiō |
32 |
1994-05-01 |
2000-07-01 |
ōzeki |
musōyama |
31 |
1994-03-01 |
2000-09-01 |
ōzeki |
hasegawa |
30 |
1965-11-01 |
1974-09-01 |
sekiwake |
kotomitsuki |
30 |
2001-01-01 |
2007-07-01 |
ōzeki |
akinoshima |
27 |
1988-11-01 |
2000-09-01 |
sekiwake |
takamiyama |
27 |
1969-11-01 |
1982-09-01 |
sekiwake |
takatōriki |
26 |
1991-05-01 |
2000-05-01 |
sekiwake |
wakanosato |
26 |
2000-11-01 |
2005-09-01 |
sekiwake |
daikirin |
22 |
1966-11-01 |
1970-09-01 |
ōzeki |
tochiazuma ii |
22 |
1997-07-01 |
2005-01-01 |
ōzeki |
kisenosato |
22 |
2006-07-01 |
2011-09-01 |
ōzeki |
Step 2: Select row number 1.
name |
total |
first |
last |
highest_rank |
date_diff |
daikirin |
22 |
1966-11-01 |
1970-09-01 |
ōzeki |
4 |
wakanosato |
26 |
2000-11-01 |
2005-09-01 |
sekiwake |
5 |
kisenosato |
22 |
2006-07-01 |
2011-09-01 |
ōzeki |
5 |
kaiō |
32 |
1994-05-01 |
2000-07-01 |
ōzeki |
6 |
musōyama |
31 |
1994-03-01 |
2000-09-01 |
ōzeki |
6 |
kotomitsuki |
30 |
2001-01-01 |
2007-07-01 |
ōzeki |
6 |
tochiazuma ii |
22 |
1997-07-01 |
2005-01-01 |
ōzeki |
8 |
kotonishiki |
34 |
1990-09-01 |
1999-09-01 |
sekiwake |
9 |
hasegawa |
30 |
1965-11-01 |
1974-09-01 |
sekiwake |
9 |
takatōriki |
26 |
1991-05-01 |
2000-05-01 |
sekiwake |
9 |
akinoshima |
27 |
1988-11-01 |
2000-09-01 |
sekiwake |
12 |
takamiyama |
27 |
1969-11-01 |
1982-09-01 |
sekiwake |
13 |
Step 3: Select rows where 'name' is 'takamiyama'.
name |
total |
first |
last |
highest_rank |
date_diff |
daikirin |
22 |
1966-11-01 |
1970-09-01 |
ōzeki |
4 |
Step 4: Use a `CASE` statement to return TRUE if the number of rows is equal to 1 and the difference between the 'last' and 'first' columns is 13 years, otherwise return FALSE.
name |
total |
first |
last |
highest_rank |
date_diff |