Hi! Could we please enable some services and cookies to improve your experience and our website?
Privacy & Cookie Policy.Hey there!
If sqltest.online has ever helped you learn SQL, practice for an interview, or just satisfy your curiosity. I'd love to hear about it.
This project is something I built and maintain on my own, completely free, because I believe SQL skills should be accessible to everyone. No subscriptions, no paywalls. Just a tool I genuinely enjoy making better.
If you've found it useful, the best thing you can do is share your honest opinion:
And if you do post, please send me the link at ✉️ rozhnev@gmail.com. I'd love to read it and say thank you personally.
❤️ Thank you for using sqltest.online. You're the reason it keeps going.
Slava Rozhnev, creator of sqltest.online
What is the total length of streets (in kilometers) in New York City?
Output the result in single column streets_length.
Use PostGIS (PostgreSQL) syntax to write your answer. Descriptions of tables are provided in the right pane.
Write your request in the field below and click the "Check it!" button.The Countries database is a PostGIS sample database designed for geographic and geospatial data analysis. It includes spatial information about countries, capitals, and New York City data such as census blocks, homicides, neighborhoods, streets, and subway stations, suitable for GIS applications and spatial queries.
| id | name | border |
|---|---|---|
| 1 | France | MultiPolygon(...) [SRID=4326] |
| id | name | country_id | location |
|---|---|---|---|
| 1 | Paris | 1 | Point(...) [SRID=4326] |
| gid | blkid | popn_total | popn_white | popn_black | popn_nativ | popn_asian | popn_other | boroname | geom |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 360050001001000 | 1000 | 500 | 200 | 50 | 150 | 100 | Manhattan | MultiPolygon(...) [SRID=4326] |
| gid | incident_d | boroname | num_victim | primary_mo | id | weapon | light_dark | year | geom |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 2003-01-01 | Manhattan | 1 | Unknown | 1 | Firearm | D | 2003 | Point(...) [SRID=4326] |
| gid | boroname | name | geom |
|---|---|---|---|
| 1 | Manhattan | Financial District | MultiPolygon(...) [SRID=4326] |
| gid | id | name | oneway | type | geom |
|---|---|---|---|---|---|
| 1 | 1 | Broadway | NO | avenue | LineString(...) [SRID=4326] |
| gid | objectid | id | name | alt_name | cross_st | long_name | label | borough | nghbhd | routes | transfers | color | express | closed | geom |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | Times Square | Times Sq | 7th Ave | Times Square-42nd Street | Times Sq | Manhattan | Midtown | 1,2,3,7,A,C,E,N,Q,R,S,W | 42nd St | Red | Yes | No | Point(...) [SRID=4326] |