Plan-of-SQLs Interface TP

Task: Verify the Statement against the Table

Statement: the geo id for janke township in logan county is 3804740620

Table: list of townships in north dakota

township county pop__2010_ land___sqmi__ water__sqmi_ latitude longitude geo_id ansi_code
jackson sargent 33 35.809 0.0 46.066276 - 97.945530 3808140460 1036797
james hill mountrail 32 31.82 4.243 48.423125 - 102.429934 3806140500 1037048
james river valley dickey 40 28.597 0.0 46.246641 - 98.188329 3802140540 1036767
janke logan 28 35.995 0.163 46.415512 - 99.131701 3804740620 1037193
jefferson pierce 45 35.069 1.125 48.232149 - 100.182370 3806940700 1759556
jim river valley stutsman 38 34.134 1.746 47.112388 - 98.778478 3809340780 1036484
johnson wells 36 35.299 0.908 47.377745 - 99.458677 3810340820 1037137
johnstown grand forks 79 36.199 0.0 48.151362 - 97.449033 3803540940 1036624
joliette pembina 67 70.044 0.771 48.796545 - 97.217227 3806741020 1036723
Generating plan to answer the query...

Generated steps

Step 1: Select rows where 'township' is 'janke' and 'county' is 'logan'.

Step 2: Select rows where 'geo_id' is 3804740620.

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

Step 1: Select rows where 'township' is 'janke' and 'county' is 'logan'.

SQL command for the step:

SELECT * FROM table_sql WHERE township = 'janke' AND county = 'logan';
township county pop__2010_ land___sqmi__ water__sqmi_ latitude longitude geo_id ansi_code
jackson sargent 33 35.809 0.0 46.066276 - 97.945530 3808140460 1036797
james hill mountrail 32 31.82 4.243 48.423125 - 102.429934 3806140500 1037048
james river valley dickey 40 28.597 0.0 46.246641 - 98.188329 3802140540 1036767
janke logan 28 35.995 0.163 46.415512 - 99.131701 3804740620 1037193
jefferson pierce 45 35.069 1.125 48.232149 - 100.182370 3806940700 1759556
jim river valley stutsman 38 34.134 1.746 47.112388 - 98.778478 3809340780 1036484
johnson wells 36 35.299 0.908 47.377745 - 99.458677 3810340820 1037137
johnstown grand forks 79 36.199 0.0 48.151362 - 97.449033 3803540940 1036624
joliette pembina 67 70.044 0.771 48.796545 - 97.217227 3806741020 1036723

Step 2: Select rows where 'geo_id' is 3804740620.

SQL command for the step:

SELECT * FROM table_sql WHERE geo_id = 3804740620;
township county pop__2010_ land___sqmi__ water__sqmi_ latitude longitude geo_id ansi_code
janke logan 28 35.995 0.163 46.415512 - 99.131701 3804740620 1037193

Step 3: 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;
township county pop__2010_ land___sqmi__ water__sqmi_ latitude longitude geo_id ansi_code
janke logan 28 35.995 0.163 46.415512 - 99.131701 3804740620 1037193

Verification:

The statement is TRUE