Plan-of-SQLs Interface TN

Task: Verify the Statement against the Table

Statement: ngc 1705 redshift faster than ngc2082 by 441 kilometers per second plus or minus 6 kilometers per second

Table: dorado group

name type ra___j2000__ dec___j2000__ redshift__km___s__ apparent_magnitude
ngc 2082 sab (rs + ) c 05h41 m51.1s degree18′04″ 1184 ± 6 12.6
ngc 1947 s0 - pec 05h26 m47.6s degree45′36″ 1100 ± 24 11.7
ngc 1796 (r) sb (r) dm : 05h02 m42.5s degree08′24″ 1014 ± 9 12.9
ngc 1688 sb (rs) dm 04h48 m23.8s degree48′01″ 1228 ± 6 12.6
ngc 1672 (r'_1: ) sb (r) bc sy2 04h45 m42.5s degree14′50″ 1331 ± 3 10.3
ic 2056 sab (r) b 04h16 m24.5s degree12′25″ 1133 ± 10 12.5
ngc 1559 sb (s) cd 04h17 m35.8s degree47′01″ 1304 ± 4 11.0
ngc 1543 (r) sb (l) 0 0 04h12 m43.2s degree44′17″ 1176 ± 7 11.5
ngc 1574 sa0 - 04h21 m58.8s degree58′29″ 1050 ± 25 11.4
ngc 1533 (l) sb (rs) 0 0 04h09 m51.8s degree07′06″ 790 ± 5 11.7
ngc 1546 sa0 + 04h14 m36.5s degree03′39″ 1284 ± 14 11.8
ngc 1553 sa (rl) 0 0 04h16 m10.5s degree46′49″ 1080 ± 11 10.3
ngc 1549 e0 1 04h15 m45.1s degree35′32″ 1220 ± 15 10.7
ngc 1566 (r'_1) sab (rs) bcsy1 04h20 m00.4s degree56′16″ 1504 ± 2 10.3
ngc 1617 (r') sab (rs) a 04h31 m39.5s degree36′08″ 1063 ± 21 11.4
ngc 1515 sab (s) bc 04h04 m02.7s degree06′00″ 1175 ± 7 12.1
ngc 1705 sa0 - pec 04h54 m13.5s degree21′40″ 633 ± 6 12.8
ngc 1596 sa0: sp 04h27 m38.1s degree01′40″ 1510 ± 8 12.1
Generating plan to answer the query...

Generated steps

Step 1: Select rows where 'name' is 'ngc 1705' or 'ngc 2082'.

Step 2: Extract the numerical value from the 'redshift__km___s__' column then add column 'redshift' to existing table.

Step 3: Use a `CASE` statement to return TRUE if the difference between the redshift values of 'ngc 1705' and 'ngc 2082' is equal to 441, otherwise return FALSE.

Step 1: Select rows where 'name' is 'ngc 1705' or 'ngc 2082'.

SQL command for the step:

SELECT * FROM table_sql WHERE name IN ('ngc 1705', 'ngc 2082');
name type ra___j2000__ dec___j2000__ redshift__km___s__ apparent_magnitude
ngc 2082 sab (rs + ) c 05h41 m51.1s degree18′04″ 1184 ± 6 12.6
ngc 1947 s0 - pec 05h26 m47.6s degree45′36″ 1100 ± 24 11.7
ngc 1796 (r) sb (r) dm : 05h02 m42.5s degree08′24″ 1014 ± 9 12.9
ngc 1688 sb (rs) dm 04h48 m23.8s degree48′01″ 1228 ± 6 12.6
ngc 1672 (r'_1: ) sb (r) bc sy2 04h45 m42.5s degree14′50″ 1331 ± 3 10.3
ic 2056 sab (r) b 04h16 m24.5s degree12′25″ 1133 ± 10 12.5
ngc 1559 sb (s) cd 04h17 m35.8s degree47′01″ 1304 ± 4 11.0
ngc 1543 (r) sb (l) 0 0 04h12 m43.2s degree44′17″ 1176 ± 7 11.5
ngc 1574 sa0 - 04h21 m58.8s degree58′29″ 1050 ± 25 11.4
ngc 1533 (l) sb (rs) 0 0 04h09 m51.8s degree07′06″ 790 ± 5 11.7
ngc 1546 sa0 + 04h14 m36.5s degree03′39″ 1284 ± 14 11.8
ngc 1553 sa (rl) 0 0 04h16 m10.5s degree46′49″ 1080 ± 11 10.3
ngc 1549 e0 1 04h15 m45.1s degree35′32″ 1220 ± 15 10.7
ngc 1566 (r'_1) sab (rs) bcsy1 04h20 m00.4s degree56′16″ 1504 ± 2 10.3
ngc 1617 (r') sab (rs) a 04h31 m39.5s degree36′08″ 1063 ± 21 11.4
ngc 1515 sab (s) bc 04h04 m02.7s degree06′00″ 1175 ± 7 12.1
ngc 1705 sa0 - pec 04h54 m13.5s degree21′40″ 633 ± 6 12.8
ngc 1596 sa0: sp 04h27 m38.1s degree01′40″ 1510 ± 8 12.1

Step 2: Extract the numerical value from the 'redshift__km___s__' column then add column 'redshift' to existing table.

SQL command for the step:

ALTER TABLE table_sql ADD COLUMN redshift NUMERIC; UPDATE table_sql SET redshift = CAST(redshift__km___s__ AS NUMERIC);
name type ra___j2000__ dec___j2000__ redshift__km___s__ apparent_magnitude
ngc 2082 sab (rs + ) c 05h41 m51.1s degree18′04″ 1184 ± 6 12.6
ngc 1705 sa0 - pec 04h54 m13.5s degree21′40″ 633 ± 6 12.8

Step 3: Use a `CASE` statement to return TRUE if the difference between the redshift values of 'ngc 1705' and 'ngc 2082' is equal to 441, otherwise return FALSE.

SQL command for the step:

SELECT CASE WHEN ABS((SELECT redshift FROM table_sql WHERE name = 'ngc 1705') - (SELECT redshift FROM table_sql WHERE name = 'ngc 2082')) = 441 THEN TRUE ELSE FALSE END AS verification;
name type ra___j2000__ dec___j2000__ redshift__km___s__ apparent_magnitude redshift
ngc 2082 sab (rs + ) c 05h41 m51.1s degree18′04″ 1184 ± 6 12.6 1184.0
ngc 1705 sa0 - pec 04h54 m13.5s degree21′40″ 633 ± 6 12.8 633.0

Verification:

The statement is FALSE