Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: the number of tournaments played in 2000 was 2

Table: casey martin

year tournaments_played cuts_made wins best_finish earnings money_list_rank
1998 3 2 0 t - 23 37221 221
2000 29 14 0 t - 17 143248 179
2001 2 0 0 cut 0 n / a
2002 3 0 0 cut 0 n / a
2003 1 0 0 cut 0 n / a
2004 2 2 0 t - 69 15858 n / a
2005 1 1 0 t - 65 10547 n / a
Generating plan to answer the query...

Generated steps

Step 1: Select rows where 'year' is 2000.

Step 2: Select rows where 'tournaments_played' is 2.

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

Step 1: Select rows where 'year' is 2000.

SQL command for the step:

SELECT * FROM table_sql WHERE year = 2000;
year tournaments_played cuts_made wins best_finish earnings money_list_rank
1998 3 2 0 t - 23 37221 221
2000 29 14 0 t - 17 143248 179
2001 2 0 0 cut 0 n / a
2002 3 0 0 cut 0 n / a
2003 1 0 0 cut 0 n / a
2004 2 2 0 t - 69 15858 n / a
2005 1 1 0 t - 65 10547 n / a

Step 2: Select rows where 'tournaments_played' is 2.

SQL command for the step:

SELECT * FROM table_sql WHERE tournaments_played = 2;
year tournaments_played cuts_made wins best_finish earnings money_list_rank
2000 29 14 0 t - 17 143248 179

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

SQL command for the step:

SELECT CASE WHEN COUNT(*) = 1 THEN TRUE ELSE FALSE END AS verification FROM table_sql;
year tournaments_played cuts_made wins best_finish earnings money_list_rank

Verification:

The statement is FALSE