Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: less than half the 1984 - 1985 season games were played in the boston garden

Table: 1984 - 85 boston celtics season

game date opponent score location record
33 9999-01-02 new jersey nets 110 - 95 brendan byrne arena 27 - 6
34 9999-01-04 new york knicks 105 - 94 boston garden 28 - 6
35 9999-01-07 new york knicks 108 - 97 madison square garden 29 - 6
36 9999-01-09 chicago bulls 111 - 108 boston garden 30 - 6
37 9999-01-11 washington bullets 103 - 101 boston garden 31 - 6
38 9999-01-12 atlanta hawks 119 - 111 the omni 32 - 6
39 9999-01-16 los angeles lakers 104 - 102 boston garden 33 - 6
40 9999-01-18 indiana pacers 86 - 91 market square arena 33 - 7
41 9999-01-20 philadelphia 76ers 113 - 97 boston garden 34 - 7
42 9999-01-23 seattle supersonics 97 - 107 boston garden 34 - 8
43 9999-01-25 indiana pacers 125 - 94 boston garden 35 - 8
44 9999-01-27 portland trail blazers 128 - 127 boston garden 36 - 8
45 9999-01-29 detroit pistons 131 - 130 hartford civic center 37 - 8
46 9999-01-30 philadelphia 76ers 104 - 122 the spectrum 37 - 9
Generating plan to answer the query...

Generated steps

Step 1: Select rows where the 'location' is 'boston garden'.

Step 2: Count the number of rows selected in step 1 and add column 'boston_garden_count' to the existing table.

Step 3: Select rows where 'boston_garden_count' is less than half of the total number of rows in the table.

Step 4: 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 the 'location' is 'boston garden'.

SQL command for the step:

SELECT * FROM table_sql WHERE location = 'boston garden';
game date opponent score location record
33 9999-01-02 new jersey nets 110 - 95 brendan byrne arena 27 - 6
34 9999-01-04 new york knicks 105 - 94 boston garden 28 - 6
35 9999-01-07 new york knicks 108 - 97 madison square garden 29 - 6
36 9999-01-09 chicago bulls 111 - 108 boston garden 30 - 6
37 9999-01-11 washington bullets 103 - 101 boston garden 31 - 6
38 9999-01-12 atlanta hawks 119 - 111 the omni 32 - 6
39 9999-01-16 los angeles lakers 104 - 102 boston garden 33 - 6
40 9999-01-18 indiana pacers 86 - 91 market square arena 33 - 7
41 9999-01-20 philadelphia 76ers 113 - 97 boston garden 34 - 7
42 9999-01-23 seattle supersonics 97 - 107 boston garden 34 - 8
43 9999-01-25 indiana pacers 125 - 94 boston garden 35 - 8
44 9999-01-27 portland trail blazers 128 - 127 boston garden 36 - 8
45 9999-01-29 detroit pistons 131 - 130 hartford civic center 37 - 8
46 9999-01-30 philadelphia 76ers 104 - 122 the spectrum 37 - 9

Step 2: Count the number of rows selected in step 1 and add column 'boston_garden_count' to the existing table.

SQL command for the step:

ALTER TABLE table_sql ADD COLUMN boston_garden_count INT DEFAULT (SELECT COUNT(*) FROM table_sql);
game date opponent score location record
34 9999-01-04 new york knicks 105 - 94 boston garden 28 - 6
36 9999-01-09 chicago bulls 111 - 108 boston garden 30 - 6
37 9999-01-11 washington bullets 103 - 101 boston garden 31 - 6
39 9999-01-16 los angeles lakers 104 - 102 boston garden 33 - 6
41 9999-01-20 philadelphia 76ers 113 - 97 boston garden 34 - 7
42 9999-01-23 seattle supersonics 97 - 107 boston garden 34 - 8
43 9999-01-25 indiana pacers 125 - 94 boston garden 35 - 8
44 9999-01-27 portland trail blazers 128 - 127 boston garden 36 - 8

Step 3: Select rows where 'boston_garden_count' is less than half of the total number of rows in the table.

SQL command for the step:

SELECT * FROM table_sql WHERE boston_garden_count < (SELECT COUNT(*) / 2 FROM table_sql);
game date opponent score location record boston_garden_count
34 9999-01-04 new york knicks 105 - 94 boston garden 28 - 6 8
36 9999-01-09 chicago bulls 111 - 108 boston garden 30 - 6 8
37 9999-01-11 washington bullets 103 - 101 boston garden 31 - 6 8
39 9999-01-16 los angeles lakers 104 - 102 boston garden 33 - 6 8
41 9999-01-20 philadelphia 76ers 113 - 97 boston garden 34 - 7 8
42 9999-01-23 seattle supersonics 97 - 107 boston garden 34 - 8 8
43 9999-01-25 indiana pacers 125 - 94 boston garden 35 - 8 8
44 9999-01-27 portland trail blazers 128 - 127 boston garden 36 - 8 8

Step 4: 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;
game date opponent score location record boston_garden_count

Verification:

The statement is FALSE