File size: 39,351 Bytes
12b24c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 |
natural_query,ddl,sql_query
"give me a list of 5 closest primary roads near the property located at 7300 20th St Lot 39, Vero Beach, FL 32966.",05-roads.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('7300 20th St Lot 39, Vero Beach, FL 32966')
limit 1
)
select fullname, linearid, geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography as dist
from public.tl_2023_us_primaryroads, property
order by dist
Limit 5;"
"which is the closest primary road from 7300 20th St Lot 39, Vero Beach, FL 32966 and how far is it?",05-roads.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('7300 20th St Lot 39, Vero Beach, FL 32966')
limit 1
)
select fullname, geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography as dist
from public.tl_2023_us_primaryroads, property
order by dist
Limit 1;"
give me a list of 5 longest primary roads in the united states.,05-roads.txt,"select fullname, sum(st_length(geom::geography)) as total_length
from public.tl_2023_us_primaryroads
group by fullname
order by total_length desc
Limit 5;"
how many primary roads are there in the state of florida?,"05-roads.txt,01-state.txt","with state as (
select geom as state_geom
from public.tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select count(*) as num_primary_roads
from public.tl_2023_us_primaryroads, state
where st_contains(state_geom, geom);"
which is the longest primary road in florida?,"05-roads.txt,01-state.txt","with state as (
select geom as state_geom
from public.tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select fullname, st_length(geom::geography) as length
from public.tl_2023_us_primaryroads, state
where st_contains(state_geom, geom)
order by st_length(geom::geography) desc
limit 1;"
how many primary roads are present in Madison County?,"05-roads.txt,02-county.txt","with county as (
select geom as county_geom
from public.tl_2023_us_county
where namelsad ilike '%madison%'
limit 1
)
select count(*) as num_primary_roads
from public.tl_2023_us_primaryroads, county
where st_contains(county_geom, geom)
limit 1;
"
which is the longest primary road in Bronx county?,"05-roads.txt,02-county.txt","with state as (
select geom as county_geom
from public.tl_2023_us_county
where name ilike '%bronx%'
limit 1
)
select fullname, st_length(geom::geography) as length
from public.tl_2023_us_primaryroads, state
where st_contains(county_geom, geom)
order by st_length(geom::geography) desc
limit 1;"
what is the total length of primary roads in Florida?,"05-roads.txt,01-state.txt","with state as (
select geom as state_geom
from public.tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select sum(st_length(geom::geography)) as road_length_florida
from tl_2023_us_primaryroads, state
where st_contains(state.state_geom, geom);
"
what percentage of the primary roads are in California?,"05-roads.txt,01-state.txt","with state as (
select geom as state_geom
from public.tl_2023_us_state
where name ilike '%california%'
limit 1
),
us_total as (
select count(*) as roads_in_us
from public.tl_2023_us_primaryroads
),
california_total as (
select count(public.tl_2023_us_primaryroads.gid) as roads_in_california
from public.tl_2023_us_primaryroads, state
where st_contains(state.state_geom, public.tl_2023_us_primaryroads.geom)
)
select (us_total.roads_in_us::float / california_total.roads_in_california::float) as percentage
from us_total, california_total"
in which state does I-77 highway lie?,"05-roads.txt,01-state.txt","with road as (
select geom as road_geom
from public.tl_2023_us_primaryroads tup
where fullname ilike '%I- 77%'
limit 1
)
select name
from public.tl_2023_us_state, road
where st_contains(geom, road.road_geom)
limit 1;"
which is the biggest metropolitan city in US?,04-metropolitan.txt,"select geoid, name, st_area(geom::geography) * 0.3048 ^ 2 as area_sqm
from public.tl_2023_us_cbsa
where lsad = 'M1'
order by st_area(geom::geography) desc
limit 1;"
What is the area of New York metropolitan city?,04-metropolitan.txt,"select geoid, name, st_area(geom::geography) * 0.3048 ^ 2 as area_sqm
from public.tl_2023_us_cbsa
where name ilike '%New York%';"
"Is the 8336 104th Ct, Vero Beach, FL 32967 located in a metropolitan statistical area?",04-metropolitan.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select geoid, name
from tl_2023_us_cbsa, property
where st_contains(geom, st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269));"
How many metropolitan statistical areas are in Florida state?,"04-metropolitan.txt,01-state.txt","with florida_state as (
select geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select count(*) as num_metro_areas_florida
from tl_2023_us_cbsa, florida_state
where st_contains(florida_state.geom, tl_2023_us_cbsa.geom) and lsad = 'M1';"
"Which is the nearest metropolitan statistical area from the property located at 8336 104th Ct, Vero Beach, FL 32967?",04-metropolitan.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select name, geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography as dist
from public.tl_2023_us_cbsa, property
where tl_2023_us_cbsa.lsad = 'M1'
order by dist asc
limit 1;"
List 5 most biggest metropolitan areas in California.,"04-metropolitan.txt,01-state.txt","with cal_state as (
select geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select geoid, name, st_area(tl_2023_us_cbsa.geom::geography) * 0.3048 ^ 2 as area_sqm
from tl_2023_us_cbsa, cal_state
where st_contains(cal_state.geom, tl_2023_us_cbsa.geom) and lsad = 'M1'
order by st_area(tl_2023_us_cbsa.geom::geography) desc
limit 5;"
Where is New Haven metropolitan area located?,"04-metropolitan.txt,01-state.txt","with new_haven as (
select geom
from public.tl_2023_us_cbsa
where name ilike '%new haven%' and lsad = 'M1'
limit 1
)
select geoid, name
from tl_2023_us_state, new_haven
where st_contains(tl_2023_us_state.geom, new_haven.geom);"
Which state has the highest number of micropolitan areas?,"04-metropolitan.txt,01-state.txt","with state_to_micropolitan as (
select public.tl_2023_us_cbsa.name as micro_name,
public.tl_2023_us_cbsa.geom as micro_geom,
public.tl_2023_us_state.name as state_name,
public.tl_2023_us_state.geom as state_geom
from public.tl_2023_us_cbsa cross join public.tl_2023_us_state
where tl_2023_us_cbsa.lsad = 'M2'
)
select state_name, count(*) as n_micropolitans
from state_to_micropolitan
where st_contains(state_geom, micro_geom)
group by state_name
order by n_micropolitans desc
limit 1;"
Which state has the highest number of metropolitan areas?,"04-metropolitan.txt,01-state.txt","with state_to_metropolitan as (
select public.tl_2023_us_cbsa.name as metro_name,
public.tl_2023_us_cbsa.geom as metro_geom,
public.tl_2023_us_state.name as state_name,
public.tl_2023_us_state.geom as state_geom
from public.tl_2023_us_cbsa cross join public.tl_2023_us_state
where tl_2023_us_cbsa.lsad = 'M1'
)
select state_name, count(*) as n_metropolitans
from state_to_metropolitan
where st_contains(state_geom, metro_geom)
group by state_name
order by n_metropolitans desc
limit 1;"
"How far is the property at 8336 104th Ct, Vero Beach, FL 32967 from a major metropolitan city in US?",04-metropolitan.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select name, geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography as dist
from public.tl_2023_us_cbsa, property
where tl_2023_us_cbsa.lsad = 'M1'
order by dist asc
limit 1;"
List out all the metropolitan and micropolitan areas in the state of California.,"04-metropolitan.txt,01-state.txt","
with cal_state as (
select geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select geoid, name, lsad
from tl_2023_us_cbsa, cal_state
where st_contains(cal_state.geom, tl_2023_us_cbsa.geom);"
List out all the primary roads that pass through Mansfield Metropolitan Area.,"04-metropolitan.txt,05-roads.txt","with mansfield_metro as (
select name, geom
from tl_2023_us_cbsa
where name ilike '%mansfield%' and lsad = 'M1'
limit 1
)
select tl_2023_us_primaryroads.fullname
from public.tl_2023_us_primaryroads, mansfield_metro
where st_intersects(mansfield_metro.geom, tl_2023_us_primaryroads.geom)"
How many primary roads pass through Mansfield Metropolitan area.,"04-metropolitan.txt,05-roads.txt","with mansfield_metro as (
select name, geom
from tl_2023_us_cbsa
where name ilike '%mansfield%' and lsad = 'M1'
limit 1
)
select count(distinct tl_2023_us_primaryroads.fullname) as n_primaryroads
from public.tl_2023_us_primaryroads, mansfield_metro
where st_intersects(mansfield_metro.geom, tl_2023_us_primaryroads.geom);"
Which is the smallest metropolitan area in US?,04-metropolitan.txt,"select geoid, name, st_area(tl_2023_us_cbsa.geom::geography) * 0.3048 ^ 2 as area_sqm
from public.tl_2023_us_cbsa
where lsad = 'M1'
order by st_area(tl_2023_us_cbsa.geom::geography) asc
limit 1;"
Which county has the highest number of micropolitan areas?,"04-metropolitan.txt,02-county.txt","with county_to_micropolitan as (
select public.tl_2023_us_cbsa.name as micro_name,
public.tl_2023_us_cbsa.geom as micro_geom,
public.tl_2023_us_county.name as county_name,
public.tl_2023_us_county.geom as county_geom
from public.tl_2023_us_cbsa cross join public.tl_2023_us_county
where tl_2023_us_cbsa.lsad = 'M2'
)
select county_name, count(*) as n_micropolitans
from county_to_micropolitan
where st_contains(county_geom, micro_geom)
group by county_name
order by n_micropolitans desc
limit 1;"
What is the total count of metropolitan areas in US?,04-metropolitan.txt,"select count(*) as n_metropolitans
from tl_2023_us_cbsa
where lsad = 'M1';"
Provide me a list of US states with its metropolitan areas count.,"04-metropolitan.txt,01-state.txt","with state_to_metropolitan as (
select public.tl_2023_us_cbsa.name as metro_name,
public.tl_2023_us_cbsa.geom as metro_geom,
public.tl_2023_us_state.name as state_name,
public.tl_2023_us_state.geom as state_geom
from public.tl_2023_us_cbsa cross join public.tl_2023_us_state
where tl_2023_us_cbsa.lsad = 'M1'
)
select state_name, count(*)
from state_to_metropolitan
where st_contains(state_geom, metro_geom)
group by state_name;"
What is the total count of micropolitan areas in US?,04-metropolitan.txt,"select count(*) as n_micropolitans
from tl_2023_us_cbsa
where lsad = 'M2';"
Which is the smallest metropolitan area in Florida?,04-metropolitan.txt,"select geoid, name
from tl_2023_us_cbsa
where lsad = 'M1'
order by st_area(geom::geography) asc
limit 1;"
Which are the closest metropolitan cities in Florida?,04-metropolitan.txt,"with florida as (
select name, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select t1.name as area_1, t2.name as area_2, t1.geom::geography <-> t2.geom::geography as distance
from tl_2023_us_cbsa as t1 cross join tl_2023_us_cbsa as t2, florida
where t1.lsad = 'M1' and t2.lsad = 'M1' and st_contains(florida.geom, t1.geom) and st_contains(florida.geom, t2.geom)
and t1.geoid <> t2.geoid
order by t1.geom <-> t2.geom asc
limit 5;"
What are the neighboring states of Florida?,01-state.txt,"with florida as (
select name, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select tl_2023_us_state.name
from public.tl_2023_us_state, florida
where st_intersects(florida.geom, tl_2023_us_state.geom) and florida.name <> tl_2023_us_state.name;"
What is the area of Florida state?,01-state.txt,"select name, st_area(geom::geography) * 0.3048 ^ 2 as area_sqm
from tl_2023_us_state
where name ilike '%florida%';"
Give me a list of 5 biggest US states.,01-state.txt,"select name, st_area(geom::geography) * 0.3048 ^ 2 as area_sqm
from tl_2023_us_state
order by st_area(geom::geography) desc
limit 5;"
Which state has the highest water-to-total-area ratio?,01-state.txt,"select name
from tl_2023_us_state
order by awater / aland desc
limit 1;"
What is the average distance between the states of Michigan and North Dakota?,01-state.txt,"select st_distance(s1.geom, s2.geom) as distance
from tl_2023_us_state as s1 cross join tl_2023_us_state as s2
where s1.name ilike '%michigan%' and s2.name ilike '%north dakota%'
limit 1;"
Provide me a list of US states with count of primary roads it has.,"01-state.txt,05-roads.txt","select states.name as state_name, count(distinct roads.fullname)
from tl_2023_us_state as states cross join tl_2023_us_primaryroads as roads
where st_contains(states.geom, roads.geom)
group by state_name;"
Which state has the highest number of counties?,"01-state.txt,02-county.txt","select states.name as state_name, count(distinct counties.name) as n_counties
from tl_2023_us_state as states cross join tl_2023_us_county as counties
where st_contains(states.geom, counties.geom)
group by state_name
order by n_counties desc
limit 1;"
List out 10 nearest states from New York.,01-state.txt,"with newyork as (
select geoid, geom
from tl_2023_us_state
where name ilike '%new york%'
limit 1
)
select name
from tl_2023_us_state, newyork
where newyork.geoid <> tl_2023_us_state.geoid
order by tl_2023_us_state.geom <-> newyork.geom asc
limit 10;"
"Which US state contains the coordinates 19.2, -155.4?",01-state.txt,"select name
from tl_2023_us_state
where st_contains(geom, st_transform(st_setsrid(st_point(-155.4, 19.2), 4326),4269))
limit 1;"
Which state is Andrews County located in?,"01-state.txt,02-county.txt","with andrews as (
select geom
from tl_2023_us_county
where name ilike '%andrews%'
limit 1
)
select name
from tl_2023_us_state, andrews
where st_contains(tl_2023_us_state.geom, andrews.geom)
limit 1;"
What are the neighboring counties of Andrews County?,02-county.txt,"with andrews as (
select geoid, geom
from tl_2023_us_county
where name ilike '%andrews%'
limit 1
)
select name
from tl_2023_us_county, andrews
where st_intersects(tl_2023_us_county.geom, andrews.geom) and andrews.geoid <> tl_2023_us_county.geoid;"
Which county has the highest water-to-total-area ratio?,02-county.txt,"select name
from tl_2023_us_county
order by awater / aland desc
limit 1;"
Provide me a list of US states with total number of counties it has.,"01-state.txt,02-county.txt","select state.name as state_name, count(distinct county.name) as county_name
from tl_2023_us_state as state cross join tl_2023_us_county as county
where st_contains(state.geom, county.geom)
group by state_name;"
Which is the third largest county in United States?,02-county.txt,"select name
from tl_2023_us_county
order by st_area(geom) desc
limit 1 offset 2;"
Which is the largest county that also has a metropolitan area?,"02-county.txt,04-metropolitan.txt","select county.name, st_area(county.geom)
from tl_2023_us_county as county cross join tl_2023_us_cbsa as metro
where metro.lsad = 'M1' and st_contains(county.geom, metro.geom)
order by st_area(county.geom) desc
limit 1;"
How many primary roads does Andrews County have?,"02-county.txt,05-roads.txt","with andrews as (
select geoid, geom
from tl_2023_us_county
where name ilike '%andrews%'
limit 1
)
select count(distinct fullname)
from tl_2023_us_primaryroads, andrews
where st_contains(andrews.geom, tl_2023_us_primaryroads.geom);
"
"Which county is the property 8336 104th Ct, Vero Beach, FL 32967 located in?",02-county.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select name
from property, tl_2023_us_county
where st_contains(tl_2023_us_county.geom, st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269));"
"List out 5 neighboring counties of the county where property at 8336 104th Ct, Vero Beach, FL 32967 is located?",02-county.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select name
from property, public.tl_2023_us_county
order by tl_2023_us_county.geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269) asc
limit 5 offset 1;"
Which is the smallest county in Michigan?,"01-state.txt,02-county.txt","with michigan as (
select geoid, geom
from tl_2023_us_state
where name ilike '%michigan%'
limit 1
)
select tl_2023_us_county.name
from michigan, tl_2023_us_county
where st_contains(michigan.geom, tl_2023_us_county.geom)
order by st_area(tl_2023_us_county.geom) asc
limit 1;"
40. How many counties are there in California state and what are they?,"01-state.txt,02-county.txt","with california as (
select geoid, geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select count(distinct county.name) as n_counties
from california, tl_2023_us_county as county
where st_contains(california.geom, county.geom);"
What is the total length of coastline in Florida?,"01-state.txt,03-coastline.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select sum(st_length(coastline.geom::geography))/1000 as total_length_km
from florida, tl_2023_us_coastline as coastline
where st_intersects(florida.geom, coastline.geom);"
Which state has the longest coastline?,"01-state.txt,03-coastline.txt","select state.name, sum(st_length(coastline.geom::geography))/1000 as coastline_len_km
from tl_2023_us_state as state cross join tl_2023_us_coastline as coastline
where st_intersects(state.geom, coastline.geom)
group by state.name
order by sum(st_length(coastline.geom::geography)) desc
limit 1;"
Which is the longest coastline in Florida?,"01-state.txt,02-county.txt,03-coastline.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select coastline.name, sum(st_length(coastline.geom::geography))/1000 as length_km
from florida, public.tl_2023_us_coastline as coastline
where st_contains(florida.geom, coastline.geom)
group by coastline.name
order by length_km desc
limit 1;"
List out counties in Florida are exposed to a sea/ocean.,"01-state.txt,03-coastline.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select county.name, count(distinct coastline.name)
from public.tl_2023_us_county as county cross join public.tl_2023_us_coastline as coastline, florida
where st_intersects(county.geom, coastline.geom) and st_contains(florida.geom, county.geom)
group by county.name;"
How many US states are exposed to a sea/ocean?,"01-state.txt,03-coastline.txt","select state.name
from tl_2023_us_state as state cross join tl_2023_us_coastline as coastline
where st_intersects(state.geom, coastline.geom)
group by state.name;"
How many US counties are exposed to sea?,"02-county.txt,03-coastline.txt","select count(distinct county.name)
from tl_2023_us_county as county cross join tl_2023_us_coastline as coastline
where st_intersects(county.geom, coastline.geom);"
Which is the largest landlocked state in US?,"01-state.txt,03-coastline.txt","with states_with_coastline as (
select distinct state.name
from tl_2023_us_state as state cross join tl_2023_us_coastline as coastline
where st_contains(state.geom, coastline.geom)
)
select state.name, st_area(state.geom::geography)
from tl_2023_us_state as state, states_with_coastline
where state.name not in (select name from states_with_coastline)
order by st_area(state.geom) desc
limit 1;"
Which is the largest landlocked county in US?,"02-county.txt,03-coastline.txt","with county_with_coastline as (
select distinct county.name
from tl_2023_us_county as county cross join tl_2023_us_coastline as coastline
where st_contains(county.geom, coastline.geom)
)
select county.name, st_area(county.geom::geography)
from tl_2023_us_county as county, county_with_coastline
where county.name not in (select name from county_with_coastline)
order by st_area(county.geom) desc
limit 1;"
Which is the name of longest coastline in US?,03-coastline.txt,"select name, sum(st_length(geom::geography)) as tot_length
from tl_2023_us_coastline
group by name
order by tot_length desc
limit 1;"
Which is the shortest coastline in US?,03-coastline.txt,"select name, sum(st_length(geom::geography)) as tot_length
from tl_2023_us_coastline
group by name
order by tot_length asc
limit 1;"
Which is the longest coastline in New York?,"01-state.txt,03-coastline.txt","with new_york as (
select geoid, geom
from tl_2023_us_state
where name ilike '%new york%'
limit 1
)
select coastline.name, sum(st_length(coastline.geom::geography)) as length_meter
from tl_2023_us_coastline as coastline, new_york
where st_intersects(new_york.geom, coastline.geom)
group by coastline.name
order by length_meter desc
limit 1;"
What states do the longest coastline in US belong to?,"01-state.txt,03-coastline.txt","with longest_coastline as (
select name, sum(st_length(geom::geography)) as total_length, st_collect(geom) as geom
from tl_2023_us_coastline
group by name
order by total_length
limit 1
)
select state.name
from longest_coastline, tl_2023_us_state as state
where st_intersects(longest_coastline.geom, state.geom);"
What is the length of shortest coastline in California?,"01-state.txt,03-coastline.txt","with california as (
select geoid, geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select coastline.name, sum(st_length(coastline.geom::geography))/1000 as length_km
from tl_2023_us_coastline as coastline, california
where st_intersects(california.geom, coastline.geom)
group by coastline.name
order by sum(st_length(coastline.geom::geography)) asc
limit 1;"
What is the length of longest coastline in California?,"01-state.txt,03-coastline.txt","with california as (
select geoid, geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select coastline.name, sum(st_length(coastline.geom::geography))/1000 as length_km
from tl_2023_us_coastline as coastline, california
where st_intersects(california.geom, coastline.geom)
group by coastline.name
order by sum(st_length(coastline.geom::geography)) desc
limit 1;"
What is the average length of a coastline in US?,03-coastline.txt,"with coastlines as (
select coastline.name, sum(st_length(coastline.geom::geography))/1000 as length_km
from tl_2023_us_coastline as coastline
group by coastline.name
)
select avg(coastlines.avg_length_km)
from coastlines;"
What is the average length of a coastline in Florida?,"01-state.txt,03-coastline.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
),
coastlines as (
select coastline.name, sum(st_length(coastline.geom::geography))/1000 as length_km
from tl_2023_us_coastline as coastline, florida
where st_intersects(florida.geom, coastline.geom)
group by coastline.name
)
select avg(coastlines.length_km)
from coastlines;"
"How far is the nearest coastline from the property located at 8336 104th Ct, Vero Beach, FL 32967?",,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select coastline.name, (geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography) / 1000 as dist_km
from property, tl_2023_us_coastline as coastline
order by dist_km asc
limit 1;"
"Is there any coastline within 1000 km radius of the location 8336 104th Ct, Vero Beach, FL 32967?",03-coastline.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select coastline.name, (geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography) / 1000 as dist_km
from property, tl_2023_us_coastline as coastline
order by dist_km asc
limit 1;"
How far is the nearest coastline from the state of Nevada?,"01-state.txt,03-coastline.txt","with nevada as (
select geoid, geom
from tl_2023_us_state
where name ilike '%nevada%'
limit 1
)
select coastline.name, (nevada.geom <-> coastline.geom) / 1000 as dist_km
from nevada, tl_2023_us_coastline as coastline
order by dist_km asc
limit 1;"
Where is Stone Ranch military resident located?,"01-state.txt,06-military.txt","with stone_ranch as (
select geom
from tl_2023_us_mil
where fullname ilike '%stone ranch%'
limit 1
)
select name
from tl_2023_us_state as state, stone_ranch
where st_contains(state.geom, stone_ranch.geom);"
Which state has the highest no of military residential areas?,"01-state.txt,06-military.txt","select state.name, count(military_areas.fullname) as num_military_areas
from tl_2023_us_state as state cross join tl_2023_us_mil as military_areas
where st_contains(state.geom, military_areas.geom)
group by state.name
order by num_military_areas desc
limit 1;"
Which is the largest military installation area?,06-military.txt,"select fullname
from tl_2023_us_mil
order by st_area(geom)
limit 1;"
How many military installation areas are present in California?,"01-state.txt,06-military.txt","with california as (
select geoid, geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select count(fullname) as num_military_areas
from public.tl_2023_us_mil as military_areas, california
where st_contains(california.geom, military_areas.geom);"
Which county has the highest number of military installations?,"02-county.txt,06-military.txt","select county.name, count(military_areas.fullname) as num_military_areas
from tl_2023_us_county as county cross join tl_2023_us_mil as military_areas
where st_contains(county.geom, military_areas.geom)
group by county.name
order by num_military_areas desc
limit 1;"
Provide me a list of all military installations in California with their areas.,"01-state.txt,06-military.txt","with california as (
select geoid, geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select military_areas.fullname, st_area(military_areas.geom::geography) * 0.3048 ^ 2 as area_sqm
from public.tl_2023_us_mil as military_areas, california
where st_contains(california.geom, military_areas.geom);"
Which is the smallest military installation in US?,06-military.txt,"select fullname, st_area(geom::geography) * 0.3048 ^ 2 as area_sqm
from tl_2023_us_mil
order by st_area(geom) asc
limit 1;"
"How far is the nearest military installation from 8336 104th Ct, Vero Beach, FL 32967?",06-military.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select fullname, military_areas.geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography as dist
from property, public.tl_2023_us_mil as military_areas
order by dist asc
limit 1;"
"Are there any military installation within 1000km radius of 8336 104th Ct, Vero Beach, FL 32967?",06-military.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select fullname, (military_areas.geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography)/1000 as dist_km
from property, public.tl_2023_us_mil as military_areas
order by dist_km asc
limit 1;"
Which military installation has the highest water area occupancy?,06-military.txt,"select fullname
from tl_2023_us_mil
order by awater desc
limit 1;"
What percentage of military installations are purely based on land?,06-military.txt,"with all_military as (
select count(*) as total_areas
from tl_2023_us_mil
),
land_military as (
select count(*) as total_land
from tl_2023_us_mil
where awater = 0
)
select land_military.total_land::float / all_military.total_areas::float as percent_military
from all_military, land_military;"
Which county is Ft Riley located in?,"02-county.txt,06-military.txt","with fort_riley as (
select geom
from tl_2023_us_mil
where fullname ilike '%fort riley%'
limit 1
)
select county.name
from public.tl_2023_us_county as county, fort_riley
where st_contains(county.geom, fort_riley.geom);"
Which military installation is the largest in Washington?,"01-state.txt,06-military.txt","with washington as (
select geoid, geom
from tl_2023_us_state
where name ilike '%washington%'
limit 1
)
select fullname
from public.tl_2023_us_mil
order by st_area(geom) desc
limit 1;"
Which state has the least number of military installations?,"01-state.txt,06-military.txt","select state.name, count(military.fullname) as num_military_installations
from tl_2023_us_state as state cross join tl_2023_us_mil as military
where st_contains(state.geom, military.geom)
group by state.name
order by num_military_installations asc
limit 1;"
List 5 states with most no of military installations?,"01-state.txt,06-military.txt","select state.name, count(military.fullname) as num_military_installations
from tl_2023_us_state as state cross join tl_2023_us_mil as military
where st_contains(state.geom, military.geom)
group by state.name
order by num_military_installations desc
limit 5;"
How many naval stations are there in Florida?,"01-state.txt,06-military.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select count(*) as num_naval_stations
from florida, public.tl_2023_us_mil as military
where fullname ilike '%naval%' and st_contains(florida.geom, military.geom);
"
How many naval stations are there in entire US?,06-military.txt,"select count(*) as num_naval_stations
from public.tl_2023_us_mil as military
where fullname ilike '%naval%';"
"Are there any coast guard station near 8336 104th Ct, Vero Beach, FL 32967?",06-military.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
)
select tl_2023_us_mil.fullname, (tl_2023_us_mil.geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography)/1000 as dist_km
from property, public.tl_2023_us_mil
where fullname ilike '%coast guard%'
order by dist_km asc;"
How many coast guard station are present in Florida?,"01-state.txt,06-military.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select count(distinct fullname)
from florida, public.tl_2023_us_mil
where st_contains(florida.geom, tl_2023_us_mil.geom) and fullname ilike '%coast guard%';"
Which state has the most no of railways?,"01-state.txt,06-military.txt","select state.name as state_name, count(railways.gid) as num_railways
from tl_2023_us_state as state cross join tl_2023_us_rails as railways
where st_contains(state.geom, railways.geom)
group by state.name
order by num_railways desc
limit 1;"
Which is the longest railway in US?,07-railways.txt,"select fullname, sum(st_length(geom::geography))/1000 as length_km
from tl_2023_us_rails as railways
where fullname is not null
group by fullname
order by length_km desc
limit 1;"
Which is the longest railway in Florida?,"01-state.txt,07-railways.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
)
select railways.fullname, sum(st_length(railways.geom::geography))/1000 as length_km
from tl_2023_us_rails as railways, florida
where fullname is not null and st_intersects(florida.geom, railways.geom)
group by fullname
order by length_km desc
limit 1;"
Which is the shortest railway in US?,07-railways.txt,"select fullname, sum(st_length(geom::geography))/1000 as length_km
from tl_2023_us_rails as railways
where fullname is not null
group by fullname
order by length_km asc
limit 1;"
"Are there any railways within 1000km radius of 8336 104th Ct, Vero Beach, FL 32967?",07-railways.txt,"with property as (
SELECT
ST_X(geomout) as lon,
ST_Y(geomout) as lat
from geocode('8336 104th Ct, Vero Beach, FL 32967')
limit 1
),
near_railways as (
select railways.fullname, sum(railways.geom <-> st_transform(st_setsrid(st_point(property.lon, property.lat), 4326),4269)::geography)/1000 as dist_km
from property, tl_2023_us_rails as railways
group by railways.fullname
order by dist_km asc
)
select fullname
from near_railways
where near_railways.dist_km < 1000;"
What is the average length of a railway in United States?,07-railways.txt,"with total_lengths as (
select fullname, sum(st_length(geom::geography)/1000) as total_length
from tl_2023_us_rails as railways
where fullname is not null
group by fullname
)
select avg(total_lengths.total_length)
from total_lengths;"
What is the length of Illinois Central railway?,07-railways.txt,"select sum(st_length(geom::geography))/1000 as length_km
from tl_2023_us_rails
where fullname ilike '%illinois central';"
How many railways are there in Michigan?,"01-state.txt,07-railways.txt","with michigan as (
select geom
from tl_2023_us_state
where name ilike '%michigan%'
limit 1
),
michigan_railways as (
select railways.fullname
from michigan, public.tl_2023_us_rails as railways
where st_contains(michigan.geom, railways.geom) and railways.fullname is not null
group by railways.fullname
)
select count(*) as num_railways
from michigan_railways;"
List 5 counties with most no of railways.,"02-county.txt,07-railways.txt","select county.name, count(railways.fullname) as num_railways
from tl_2023_us_rails as railways cross join tl_2023_us_county as county
where st_contains(county.geom, railways.geom)
group by railways.fullname, county.name
order by num_railways desc
limit 5;"
Which counties do At and Sf railway pass through?,"02-county.txt,07-railways.txt","select distinct county.name
from tl_2023_us_county as county cross join tl_2023_us_rails as railways
where st_contains(county.geom, railways.geom) and railways.fullname ilike '%at and sf%'"
Give me list of counties and number of railways in state of Florida.,"01-state.txt,02-county.txt,07-railways.txt","with florida as (
select geoid, geom
from tl_2023_us_state
where name ilike '%florida%'
limit 1
),
florida_railways as (
select county.name as county_name, railways.fullname as railway
from tl_2023_us_county as county cross join tl_2023_us_rails as railways, florida
where st_contains(florida.geom, county.geom) and st_contains(county.geom, railways.geom)
group by railways.fullname, county.name
)
select county_name, count(*)
from florida_railways
group by county_name;"
Which is the shortest railway in California?,"01-state.txt,07-railways.txt","with california as (
select geom
from tl_2023_us_state
where name ilike '%california%'
limit 1
)
select railways.fullname, sum(st_length(railways.geom::geography))/1000 as length_km
from california, tl_2023_us_rails as railways
where railways.fullname is not null and st_contains(california.geom, railways.geom)
group by railways.fullname
order by length_km asc
limit 1;"
Which county has the highest no of railways?,"02-county.txt,07-railways.txt","with county_railways as (
select county.name as county_name, rails.fullname as railway_name
from tl_2023_us_county as county cross join tl_2023_us_rails as rails
where st_contains(county.geom, rails.geom) and rails.fullname is not null
),
railway_counts as (
select county_name, count(railway_name) as railway_count
from county_railways
group by county_name
)
select county_name
from railway_counts
order by railway_count desc
limit 1;"
Which metropolitan city has the highest no of railways?,"04-metropolitan.txt,07-railways.txt","with metro_railways as (
select metro.name as metro_name, rails.fullname as railway_name
from public.tl_2023_us_cbsa as metro cross join tl_2023_us_rails as rails
where st_contains(metro.geom, rails.geom) and rails.fullname is not null and metro.lsad = 'M1'
),
railway_counts as (
select metro_name, count(railway_name) as railway_count
from metro_railways
group by metro_name
)
select metro_name
from railway_counts
order by railway_count desc
limit 1;"
What is the average no of railways in a metropolitan area in US?,"04-metropolitan.txt,07-railways.txt","with metro_railways as (
select metro.name as metro_name, rails.fullname as railway_name
from public.tl_2023_us_cbsa as metro cross join tl_2023_us_rails as rails
where st_contains(metro.geom, rails.geom) and rails.fullname is not null and metro.lsad = 'M1'
),
railway_counts as (
select metro_name, count(railway_name) as railway_count
from metro_railways
group by metro_name
)
select avg(railway_count) as average_railway_count
from railway_counts;"
What is the average no of railways in a micropolitan area in US?,"04-metropolitan.txt,07-railways.txt","with micro_railways as (
select micro.name as micro_name, rails.fullname as railway_name
from public.tl_2023_us_cbsa as micro cross join tl_2023_us_rails as rails
where st_contains(micro.geom, rails.geom) and rails.fullname is not null and micro.lsad = 'M2'
),
railway_counts as (
select micro_name, count(railway_name) as railway_count
from micro_railways
group by micro_name
)
select avg(railway_count) as average_railway_count
from railway_counts;"
Which states do not have any railways?,"01-state.txt,07-railways.txt","with state_with_railways as (
select distinct state.name
from tl_2023_us_state as state cross join tl_2023_us_rails as railways
where st_contains(state.geom, railways.geom)
group by state.name
)
select distinct state.name as states
from state_with_railways, public.tl_2023_us_state as state
where state.name not in (select name from state_with_railways);"
How many counties in US do not have any railways?,"02-county.txt,07-railways.txt","with county_with_railways as (
select distinct county.name
from tl_2023_us_county as county cross join tl_2023_us_rails as railways
where st_contains(county.geom, railways.geom)
group by county.name
)
select count(distinct county.name) as n_counties
from county_with_railways, public.tl_2023_us_county as county
where county.name not in (select name from county_with_railways);
"
What is the length of Missouri Pacific railway?,07-railways.txt,"select fullname, sum(st_length(geom::geography))/1000 as length_km
from tl_2023_us_rails
where fullname ilike '%missouri pacific%' and fullname is not null
group by fullname
limit 1;"
Provide me a list of 5 longest railways in US.,07-railways.txt,"select fullname, sum(st_length(geom::geography))/1000 as length_km
from tl_2023_us_rails
where fullname is not null
group by fullname
order by length_km desc
limit 5;" |