Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: the 2005 nominee for best costume design won the award

Table: la cage aux folles (musical)

year award category nominee result
2005 tony award best revival of a musical best revival of a musical won
2005 tony award best performance by a leading actor in a musical gary beach nominated
2005 tony award best choreography jerry mitchell won
2005 tony award best costume design william ivey long nominated
2005 drama desk award outstanding revival of a musical outstanding revival of a musical won
2005 drama desk award outstanding choreography jerry mitchell won
2005 drama desk award outstanding costume design william ivey long nominated
Generating plan to answer the query...

Generated steps

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

Step 2: Select rows where 'category' is 'best costume design'.

Step 3: Select rows where 'result' is 'won'.

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 2005.

SQL command for the step:

SELECT * FROM table_sql WHERE year = 2005;
year award category nominee result
2005 tony award best revival of a musical best revival of a musical won
2005 tony award best performance by a leading actor in a musical gary beach nominated
2005 tony award best choreography jerry mitchell won
2005 tony award best costume design william ivey long nominated
2005 drama desk award outstanding revival of a musical outstanding revival of a musical won
2005 drama desk award outstanding choreography jerry mitchell won
2005 drama desk award outstanding costume design william ivey long nominated

Step 2: Select rows where 'category' is 'best costume design'.

SQL command for the step:

SELECT * FROM table_sql WHERE category = 'best costume design';
year award category nominee result
2005 tony award best revival of a musical best revival of a musical won
2005 tony award best performance by a leading actor in a musical gary beach nominated
2005 tony award best choreography jerry mitchell won
2005 tony award best costume design william ivey long nominated
2005 drama desk award outstanding revival of a musical outstanding revival of a musical won
2005 drama desk award outstanding choreography jerry mitchell won
2005 drama desk award outstanding costume design william ivey long nominated

Step 3: Select rows where 'result' is 'won'.

SQL command for the step:

SELECT * FROM table_sql WHERE result = 'won';
year award category nominee result
2005 tony award best costume design william ivey long 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 category nominee result

Verification:

The statement is FALSE