Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: the united states team won 8 of the solheim cups starting in 1990 and the last was in 2009

Table: solheim cup

year venue winning_team score usa_captain europe_captain
2013-01-01 colorado golf club , colorado , usa europe 18 - 10 meg mallon liselotte neumann
2011-01-01 killeen castle golf resort , ireland europe 15 - 13 rosie jones alison nicholas
2009-01-01 rich harvest farms , illinois , usa united states 16 - 12 beth daniel alison nicholas
2007-01-01 halmstad gk , sweden united states 16 - 12 betsy king helen alfredsson
2005-01-01 crooked stick golf club , indiana , usa united states 15½ - 12½ nancy lopez catrin nilsmark
2003-01-01 barsebäck golf & country club , sweden europe 17½ - 10½ patty sheehan catrin nilsmark
2002-01-01 interlachen country club , minnesota , usa united states 15½ - 12½ patty sheehan dale reid
2000-01-01 loch lomond golf club , scotland europe 14½ - 11½ pat bradley dale reid
1998-01-01 muirfield village , ohio , usa united states 16 - 12 judy rankin pia nilsson
1996-01-01 st pierre golf & country club , wales united states 17 - 11 judy rankin mickey walker
1994-01-01 the greenbrier , west virginia , usa united states 13 - 7 joanne carner mickey walker
1992-01-01 dalmahoy country club , scotland europe 11½ - 6½ kathy whitworth mickey walker
1990-01-01 lake nona golf & country club , florida , usa united states 11½ - 4½ kathy whitworth mickey walker
Generating plan to answer the query...

Generated steps

Step 1: Select rows where 'winning_team' is 'united states'.

Step 2: Select rows where 'year' is greater than or equal to 1990 and less than or equal to 2009.

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

Step 1: Select rows where 'winning_team' is 'united states'.

SQL command for the step:

SELECT * FROM table_sql WHERE winning_team = 'united states';
year venue winning_team score usa_captain europe_captain
2013-01-01 colorado golf club , colorado , usa europe 18 - 10 meg mallon liselotte neumann
2011-01-01 killeen castle golf resort , ireland europe 15 - 13 rosie jones alison nicholas
2009-01-01 rich harvest farms , illinois , usa united states 16 - 12 beth daniel alison nicholas
2007-01-01 halmstad gk , sweden united states 16 - 12 betsy king helen alfredsson
2005-01-01 crooked stick golf club , indiana , usa united states 15½ - 12½ nancy lopez catrin nilsmark
2003-01-01 barsebäck golf & country club , sweden europe 17½ - 10½ patty sheehan catrin nilsmark
2002-01-01 interlachen country club , minnesota , usa united states 15½ - 12½ patty sheehan dale reid
2000-01-01 loch lomond golf club , scotland europe 14½ - 11½ pat bradley dale reid
1998-01-01 muirfield village , ohio , usa united states 16 - 12 judy rankin pia nilsson
1996-01-01 st pierre golf & country club , wales united states 17 - 11 judy rankin mickey walker
1994-01-01 the greenbrier , west virginia , usa united states 13 - 7 joanne carner mickey walker
1992-01-01 dalmahoy country club , scotland europe 11½ - 6½ kathy whitworth mickey walker
1990-01-01 lake nona golf & country club , florida , usa united states 11½ - 4½ kathy whitworth mickey walker

Step 2: Select rows where 'year' is greater than or equal to 1990 and less than or equal to 2009.

SQL command for the step:

SELECT * FROM table_sql WHERE year >= 1990 AND year <= 2009;
year venue winning_team score usa_captain europe_captain
2009-01-01 rich harvest farms , illinois , usa united states 16 - 12 beth daniel alison nicholas
2007-01-01 halmstad gk , sweden united states 16 - 12 betsy king helen alfredsson
2005-01-01 crooked stick golf club , indiana , usa united states 15½ - 12½ nancy lopez catrin nilsmark
2002-01-01 interlachen country club , minnesota , usa united states 15½ - 12½ patty sheehan dale reid
1998-01-01 muirfield village , ohio , usa united states 16 - 12 judy rankin pia nilsson
1996-01-01 st pierre golf & country club , wales united states 17 - 11 judy rankin mickey walker
1994-01-01 the greenbrier , west virginia , usa united states 13 - 7 joanne carner mickey walker
1990-01-01 lake nona golf & country club , florida , usa united states 11½ - 4½ kathy whitworth mickey walker

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

SQL command for the step:

SELECT CASE WHEN COUNT(*) = 8 THEN TRUE ELSE FALSE END AS verification FROM table_sql;
year venue winning_team score usa_captain europe_captain
2009-01-01 rich harvest farms , illinois , usa united states 16 - 12 beth daniel alison nicholas
2007-01-01 halmstad gk , sweden united states 16 - 12 betsy king helen alfredsson
2005-01-01 crooked stick golf club , indiana , usa united states 15½ - 12½ nancy lopez catrin nilsmark
2002-01-01 interlachen country club , minnesota , usa united states 15½ - 12½ patty sheehan dale reid
1998-01-01 muirfield village , ohio , usa united states 16 - 12 judy rankin pia nilsson
1996-01-01 st pierre golf & country club , wales united states 17 - 11 judy rankin mickey walker
1994-01-01 the greenbrier , west virginia , usa united states 13 - 7 joanne carner mickey walker
1990-01-01 lake nona golf & country club , florida , usa united states 11½ - 4½ kathy whitworth mickey walker

Verification:

The statement is TRUE