Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: nelson is not the province for the electorate of collingwood

Table: 3rd new zealand parliament

member electorate province mps_term election_date
alfred creyke avon canterbury first 1861-01-01
frederick weld cheviot canterbury third 1861-01-01
andrew richmond collingwood nelson first 1861-04-01
isaac cookson kaiapoi canterbury second 1861-07-01
herbert curtis motueka nelson second 1861-05-01
william fox rangitiki wellington second 1861-04-01
alfred saunders waimea marlborough first 1861-01-01
Generating plan to answer the query...

Generated steps

Step 1: Select rows where the 'electorate' is 'collingwood'.

Step 2: Select rows where the 'province' is 'nelson'.

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

Step 1: Select rows where the 'electorate' is 'collingwood'.

SQL command for the step:

SELECT * FROM table_sql WHERE electorate = 'collingwood';
member electorate province mps_term election_date
alfred creyke avon canterbury first 1861-01-01
frederick weld cheviot canterbury third 1861-01-01
andrew richmond collingwood nelson first 1861-04-01
isaac cookson kaiapoi canterbury second 1861-07-01
herbert curtis motueka nelson second 1861-05-01
william fox rangitiki wellington second 1861-04-01
alfred saunders waimea marlborough first 1861-01-01

Step 2: Select rows where the 'province' is 'nelson'.

SQL command for the step:

SELECT * FROM table_sql WHERE province = 'nelson';
member electorate province mps_term election_date
andrew richmond collingwood nelson first 1861-04-01

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

SQL command for the step:

SELECT CASE WHEN COUNT(*) = 0 THEN TRUE ELSE FALSE END AS verification FROM table_sql;
member electorate province mps_term election_date
andrew richmond collingwood nelson first 1861-04-01

Verification:

The statement is FALSE