Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: the highest score for a winning team was 18 , while the lowest score for a winning team was 13

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: Order the table by 'score' in descending order.

Step 2: Select row number 1.

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

Step 4: Use a `CASE` statement to return TRUE if the number of rows is equal to 1 and the score is 18, otherwise return FALSE.

Step 1: Order the table by 'score' in descending order.

SQL command for the step:

SELECT * FROM table_sql ORDER BY score DESC;
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 row number 1.

SQL command for the step:

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

Step 3: 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 usa_score europe_score
2013-01-01 colorado golf club , colorado , usa europe 18 - 10 meg mallon liselotte neumann 18 10

Step 4: Use a `CASE` statement to return TRUE if the number of rows is equal to 1 and the score is 18, otherwise return FALSE.

SQL command for the step:

SELECT CASE WHEN COUNT(*) = 1 AND MAX(score) = 18 THEN TRUE ELSE FALSE END AS verification FROM table_sql;
year venue winning_team score usa_captain europe_captain usa_score europe_score

Verification:

The statement is FALSE