Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: casey martin never won a tournament

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 'wins' is greater than 0.

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

Step 1: Select rows where 'wins' is greater than 0.

SQL command for the step:

SELECT * FROM table_sql WHERE wins > 0;
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: Use a `CASE` statement to return FALSE if the number of rows is greater than or equal to 1, otherwise return TRUE.

SQL command for the step:

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

Verification:

The statement is TRUE