Plan-of-SQLs Interface FP

Task: Verify the Statement against the Table

Statement: equestrian at the asian games happened every four years from 1982 to 2010

Table: equestrian at the asian games

year location gold silver bronze
1982 new delhi nadia al - moutawaa jamila al - moutawaa bariaa salem al - sabbah
1986 seoul takashi tomura shuichi toki ryuzo okuno
1994 hiroshima konoshin kuwahara ryuzo okuno natya chantrasmi
1998 bangkok jin kanno sohn bong - gak quzier ambak fathil
2002 busan mikaela marã­a jaworski lee jin - kyung tadayoshi hayashi
2006 doha ali yousuf al - rumaihi jasmine chen - shao man joo jung - hyun
2010 guangzhou ramzy al duhami latifa al maktom khaled al - eid
Generating plan to answer the query...

Generated steps

Step 1: Extract the numerical year from the 'year' column then add column 'num_year' to existing table.

Step 2: Select rows where 'num_year' is between 1982 and 2010.

Step 3: Use a `CASE` statement to return TRUE if the number of rows is equal to 7, otherwise return FALSE.

Step 1: Extract the numerical year from the 'year' column then add column 'num_year' to existing table.

SQL command for the step:

ALTER TABLE table_sql ADD COLUMN num_year INT GENERATED ALWAYS AS (CAST(year AS INT)) STORED;
year location gold silver bronze
1982 new delhi nadia al - moutawaa jamila al - moutawaa bariaa salem al - sabbah
1986 seoul takashi tomura shuichi toki ryuzo okuno
1994 hiroshima konoshin kuwahara ryuzo okuno natya chantrasmi
1998 bangkok jin kanno sohn bong - gak quzier ambak fathil
2002 busan mikaela marã­a jaworski lee jin - kyung tadayoshi hayashi
2006 doha ali yousuf al - rumaihi jasmine chen - shao man joo jung - hyun
2010 guangzhou ramzy al duhami latifa al maktom khaled al - eid

Step 2: Select rows where 'num_year' is between 1982 and 2010.

SQL command for the step:

SELECT * FROM table_sql WHERE num_year BETWEEN 1982 AND 2010;
year location gold silver bronze num_year
1982 new delhi nadia al - moutawaa jamila al - moutawaa bariaa salem al - sabbah 1982
1986 seoul takashi tomura shuichi toki ryuzo okuno 1986
1994 hiroshima konoshin kuwahara ryuzo okuno natya chantrasmi 1994
1998 bangkok jin kanno sohn bong - gak quzier ambak fathil 1998
2002 busan mikaela marã­a jaworski lee jin - kyung tadayoshi hayashi 2002
2006 doha ali yousuf al - rumaihi jasmine chen - shao man joo jung - hyun 2006
2010 guangzhou ramzy al duhami latifa al maktom khaled al - eid 2010

Step 3: Use a `CASE` statement to return TRUE if the number of rows is equal to 7, otherwise return FALSE.

SQL command for the step:

SELECT CASE WHEN COUNT(*) = 7 THEN TRUE ELSE FALSE END AS verification FROM table_sql;
year location gold silver bronze num_year
1982 new delhi nadia al - moutawaa jamila al - moutawaa bariaa salem al - sabbah 1982
1986 seoul takashi tomura shuichi toki ryuzo okuno 1986
1994 hiroshima konoshin kuwahara ryuzo okuno natya chantrasmi 1994
1998 bangkok jin kanno sohn bong - gak quzier ambak fathil 1998
2002 busan mikaela marã­a jaworski lee jin - kyung tadayoshi hayashi 2002
2006 doha ali yousuf al - rumaihi jasmine chen - shao man joo jung - hyun 2006
2010 guangzhou ramzy al duhami latifa al maktom khaled al - eid 2010

Verification:

The statement is TRUE