Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: neil labute was nominated for best play in 2009

Table: reasons to be pretty

year award_ceremony category nominee result
2009 tony award best play neil labute nominated
2009 tony award best performance by a leading actor in a play thomas sadoski nominated
2009 tony award best performance by a featured actress in a play marin ireland nominated
2009 drama desk award outstanding play outstanding play nominated
2009 drama desk award outstanding actor in a play thomas sadoski nominated
2009 drama desk award outstanding director of a play terry kinney nominated
2009 theatre world award theatre world award marin ireland won
Generating plan to answer the query...

Generated steps

Step 1: Select rows where 'nominee' is 'neil labute'.

Step 2: Select rows where 'category' is 'best play'.

Step 3: Select rows where 'year' is 2009.

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

Step 1: Select rows where 'nominee' is 'neil labute'.

SQL command for the step:

SELECT * FROM table_sql WHERE nominee = 'neil labute';
year award_ceremony category nominee result
2009 tony award best play neil labute nominated
2009 tony award best performance by a leading actor in a play thomas sadoski nominated
2009 tony award best performance by a featured actress in a play marin ireland nominated
2009 drama desk award outstanding play outstanding play nominated
2009 drama desk award outstanding actor in a play thomas sadoski nominated
2009 drama desk award outstanding director of a play terry kinney nominated
2009 theatre world award theatre world award marin ireland won

Step 2: Select rows where 'category' is 'best play'.

SQL command for the step:

SELECT * FROM table_sql WHERE category = 'best play';
year award_ceremony category nominee result
2009 tony award best play neil labute nominated

Step 3: Select rows where 'year' is 2009.

SQL command for the step:

SELECT * FROM table_sql WHERE year = 2009;
year award_ceremony category nominee result
2009 tony award best play neil labute nominated

Step 4: 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 award_ceremony category nominee result
2009 tony award best play neil labute nominated

Verification:

The statement is TRUE