Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: the life expectancy in 1995 - 2000 is less than 61.5 and the imr is exactly 27

Table: none

period live_births_per_year deaths_per_year natural_change_per_year cbr cdr nc tfr imr life_expectancy_total life_expectancy_males life_expectancy_females
1950-01-01 - 1955-01-01 2 572 000 900 000 1 672 000 44.1 15.5 28.6 6.15 135 50.9 49.2 52.6
1955-01-01 - 1960-01-01 2 918 000 947 000 1 971 000 43.2 14.0 29.1 6.15 122 53.3 51.5 55.2
1960-01-01 - 1965-01-01 3 303 000 986 000 2 317 000 42.2 12.6 29.6 6.15 109 55.7 53.8 57.6
9999-01-01 - 1970-01-01 3 330 000 998 000 2 332 000 37.0 11.1 25.9 5.38 100 57.6 55.7 59.6
1970-01-01 - 1975-01-01 3 441 000 1 014 000 2 427 000 33.7 9.9 23.8 4.72 91 59.5 57.3 61.8
1975-01-01 - 1980-01-01 3 741 000 1 043 000 2 698 000 32.5 9.0 23.5 4.31 79 61.5 59.2 63.9
1980-01-01 - 1985-01-01 3 974 000 1 064 000 2 910 000 30.8 8.2 22.6 3.8 63 63.4 60.4 66.8
1985-01-01 - 1990-01-01 3 757 000 1 055 000 2 702 000 26.3 7.4 18.9 3.1 52 65.3 61.9 69.1
1990-01-01 - 1995-01-01 3 519 000 1 058 000 2 461 000 22.6 6.8 15.8 2.6 43 67.3 63.6 71.2
1995-01-01 - 2000-01-01 3 624 000 1 086 000 2 538 000 21.5 6.5 15.1 2.45 34 69.3 65.5 73.3
2000-01-01 - 2005-01-01 3 572 000 1 147 000 2 425 000 19.8 6.4 13.4 2.25 27 70.9 67.2 74.8
Generating plan to answer the query...

Generated steps

Step 1: Select rows where the 'period' is '1995-01-01 - 2000-01-01'.

Step 2: Select rows where the 'life_expectancy_total' is less than 61.5.

Step 3: Select rows where the 'imr' is equal to 27.

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 'period' is '1995-01-01 - 2000-01-01'.

SQL command for the step:

SELECT * FROM table_sql WHERE period BETWEEN '1995-01-01' AND '2000-01-01';
period live_births_per_year deaths_per_year natural_change_per_year cbr cdr nc tfr imr life_expectancy_total life_expectancy_males life_expectancy_females
1950-01-01 - 1955-01-01 2 572 000 900 000 1 672 000 44.1 15.5 28.6 6.15 135 50.9 49.2 52.6
1955-01-01 - 1960-01-01 2 918 000 947 000 1 971 000 43.2 14.0 29.1 6.15 122 53.3 51.5 55.2
1960-01-01 - 1965-01-01 3 303 000 986 000 2 317 000 42.2 12.6 29.6 6.15 109 55.7 53.8 57.6
9999-01-01 - 1970-01-01 3 330 000 998 000 2 332 000 37.0 11.1 25.9 5.38 100 57.6 55.7 59.6
1970-01-01 - 1975-01-01 3 441 000 1 014 000 2 427 000 33.7 9.9 23.8 4.72 91 59.5 57.3 61.8
1975-01-01 - 1980-01-01 3 741 000 1 043 000 2 698 000 32.5 9.0 23.5 4.31 79 61.5 59.2 63.9
1980-01-01 - 1985-01-01 3 974 000 1 064 000 2 910 000 30.8 8.2 22.6 3.8 63 63.4 60.4 66.8
1985-01-01 - 1990-01-01 3 757 000 1 055 000 2 702 000 26.3 7.4 18.9 3.1 52 65.3 61.9 69.1
1990-01-01 - 1995-01-01 3 519 000 1 058 000 2 461 000 22.6 6.8 15.8 2.6 43 67.3 63.6 71.2
1995-01-01 - 2000-01-01 3 624 000 1 086 000 2 538 000 21.5 6.5 15.1 2.45 34 69.3 65.5 73.3
2000-01-01 - 2005-01-01 3 572 000 1 147 000 2 425 000 19.8 6.4 13.4 2.25 27 70.9 67.2 74.8

Step 2: Select rows where the 'life_expectancy_total' is less than 61.5.

SQL command for the step:

SELECT * FROM table_sql WHERE life_expectancy_total < 61.5;
period live_births_per_year deaths_per_year natural_change_per_year cbr cdr nc tfr imr life_expectancy_total life_expectancy_males life_expectancy_females
1995-01-01 - 2000-01-01 3 624 000 1 086 000 2 538 000 21.5 6.5 15.1 2.45 34 69.3 65.5 73.3

Step 3: Select rows where the 'imr' is equal to 27.

SQL command for the step:

SELECT * FROM table_sql WHERE imr = 27;
period live_births_per_year deaths_per_year natural_change_per_year cbr cdr nc tfr imr life_expectancy_total life_expectancy_males life_expectancy_females

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;
period live_births_per_year deaths_per_year natural_change_per_year cbr cdr nc tfr imr life_expectancy_total life_expectancy_males life_expectancy_females

Verification:

The statement is FALSE