Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: thomas sadoski was nominated for best performance by a leading actor in a 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 'year' is 2009.

Step 2: Select rows where 'category' is 'best performance by a leading actor in a play'.

Step 3: Select rows where 'nominee' is 'thomas sadoski'.

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 '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
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 performance by a leading actor in a play'.

SQL command for the step:

SELECT * FROM table_sql WHERE category = 'best performance by a leading actor in a play';
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 3: Select rows where 'nominee' is 'thomas sadoski'.

SQL command for the step:

SELECT * FROM table_sql WHERE nominee = 'thomas sadoski';
year award_ceremony category nominee result
2009 tony award best performance by a leading actor in a play thomas sadoski 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 performance by a leading actor in a play thomas sadoski nominated

Verification:

The statement is TRUE