Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: princes park is home to the carlton team

Table: 1945 vfl season

home_team home_team_score away_team away_team_score venue crowd date
essendon 7.14 (56) fitzroy 11.14 (80) windy hill 10000 1945-07-14
collingwood 11.14 (80) south melbourne 7.12 (54) victoria park 24000 1945-07-14
carlton 13.12 (90) hawthorn 8.11 (59) princes park 10000 1945-07-14
richmond 18.10 (118) north melbourne 15.9 (99) punt road oval 21000 1945-07-14
st kilda 9.10 (64) melbourne 10.23 (83) junction oval 6000 1945-07-14
geelong 11.14 (80) footscray 13.19 (97) kardinia park 6000 1945-07-14
Generating plan to answer the query...

Generated steps

Step 1: Select rows where 'home_team' is 'carlton'.

Step 2: Select rows where 'venue' is 'princes park'.

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

Step 1: Select rows where 'home_team' is 'carlton'.

SQL command for the step:

SELECT * FROM table_sql WHERE home_team = 'carlton';
home_team home_team_score away_team away_team_score venue crowd date
essendon 7.14 (56) fitzroy 11.14 (80) windy hill 10000 1945-07-14
collingwood 11.14 (80) south melbourne 7.12 (54) victoria park 24000 1945-07-14
carlton 13.12 (90) hawthorn 8.11 (59) princes park 10000 1945-07-14
richmond 18.10 (118) north melbourne 15.9 (99) punt road oval 21000 1945-07-14
st kilda 9.10 (64) melbourne 10.23 (83) junction oval 6000 1945-07-14
geelong 11.14 (80) footscray 13.19 (97) kardinia park 6000 1945-07-14

Step 2: Select rows where 'venue' is 'princes park'.

SQL command for the step:

SELECT * FROM table_sql WHERE venue = 'princes park';
home_team home_team_score away_team away_team_score venue crowd date
carlton 13.12 (90) hawthorn 8.11 (59) princes park 10000 1945-07-14

Step 3: Use a `CASE` statement to return TRUE if the number of rows is greater than or 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;
home_team home_team_score away_team away_team_score venue crowd date
carlton 13.12 (90) hawthorn 8.11 (59) princes park 10000 1945-07-14

Verification:

The statement is TRUE