Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: on 2 may 1999 , the surface was hard

Table: leanne baker

outcome date location surface opponent_in_final score
winner 1999-05-02 coatzacoalcos , mexico hard candice jairala 3 - 6 6 - 3 7 - 5
winner 1999-07-11 felixstowe , england grass karen nugent 6 - 4 6 - 4
runner - up 2000-02-06 wellington , new zealand hard mirielle dittmann 6 - 7 (5) 6 - 1 6 - 7 (5)
runner - up 2000-05-28 el paso , texas , usa hard erin burdette 1 - 6 3 - 6
runner - up 2003-09-14 spoleto , italy clay lenka snajdrova 4 - 6 3 - 6
winner 2005-02-06 wellington , new zealand hard mirielle dittmann 2 - 6 6 - 1 6 - 1
winner 2005-08-28 jesi , italy hard vanessa pinto 6 - 2 7 - 6 (6)
winner 2006-02-05 taupo , new zealand hard natsumi hamamura 6 - 1 6 - 2
winner 2006-02-12 wellington , new zealand hard katerina kramperová 6 - 4 1 - 6 6 - 0
winner 2008-04-20 mazatlán , mexico hard anna lubinsky 6 - 2 6 - 1
Generating plan to answer the query...

Generated steps

Step 1: Order the table by 'date' in ascending order.

Step 2: Select rows where 'date' is '1999-05-02'.

Step 3: Select rows where 'surface' is 'hard'.

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

Step 1: Order the table by 'date' in ascending order.

SQL command for the step:

SELECT * FROM table_sql ORDER BY date ASC;
outcome date location surface opponent_in_final score
winner 1999-05-02 coatzacoalcos , mexico hard candice jairala 3 - 6 6 - 3 7 - 5
winner 1999-07-11 felixstowe , england grass karen nugent 6 - 4 6 - 4
runner - up 2000-02-06 wellington , new zealand hard mirielle dittmann 6 - 7 (5) 6 - 1 6 - 7 (5)
runner - up 2000-05-28 el paso , texas , usa hard erin burdette 1 - 6 3 - 6
runner - up 2003-09-14 spoleto , italy clay lenka snajdrova 4 - 6 3 - 6
winner 2005-02-06 wellington , new zealand hard mirielle dittmann 2 - 6 6 - 1 6 - 1
winner 2005-08-28 jesi , italy hard vanessa pinto 6 - 2 7 - 6 (6)
winner 2006-02-05 taupo , new zealand hard natsumi hamamura 6 - 1 6 - 2
winner 2006-02-12 wellington , new zealand hard katerina kramperová 6 - 4 1 - 6 6 - 0
winner 2008-04-20 mazatlán , mexico hard anna lubinsky 6 - 2 6 - 1

Step 2: Select rows where 'date' is '1999-05-02'.

SQL command for the step:

SELECT * FROM table_sql WHERE date = '1999-05-02';
outcome date location surface opponent_in_final score
winner 1999-05-02 coatzacoalcos , mexico hard candice jairala 3 - 6 6 - 3 7 - 5
winner 1999-07-11 felixstowe , england grass karen nugent 6 - 4 6 - 4
runner - up 2000-02-06 wellington , new zealand hard mirielle dittmann 6 - 7 (5) 6 - 1 6 - 7 (5)
runner - up 2000-05-28 el paso , texas , usa hard erin burdette 1 - 6 3 - 6
runner - up 2003-09-14 spoleto , italy clay lenka snajdrova 4 - 6 3 - 6
winner 2005-02-06 wellington , new zealand hard mirielle dittmann 2 - 6 6 - 1 6 - 1
winner 2005-08-28 jesi , italy hard vanessa pinto 6 - 2 7 - 6 (6)
winner 2006-02-05 taupo , new zealand hard natsumi hamamura 6 - 1 6 - 2
winner 2006-02-12 wellington , new zealand hard katerina kramperová 6 - 4 1 - 6 6 - 0
winner 2008-04-20 mazatlán , mexico hard anna lubinsky 6 - 2 6 - 1

Step 3: Select rows where 'surface' is 'hard'.

SQL command for the step:

SELECT * FROM table_sql WHERE surface = 'hard';
outcome date location surface opponent_in_final score
winner 1999-05-02 coatzacoalcos , mexico hard candice jairala 3 - 6 6 - 3 7 - 5

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;
outcome date location surface opponent_in_final score
winner 1999-05-02 coatzacoalcos , mexico hard candice jairala 3 - 6 6 - 3 7 - 5

Verification:

The statement is TRUE