# 1 list all sushi bars within borders of Cracow city
Expand|Select|Wrap|Line Numbers
- select name from planet_osm_point where amenity='restaurant' and name ilike '%sushi%' and ST_Within(way, (select multipolygon from krakow limit 1));
Expand|Select|Wrap|Line Numbers
- select sum(st_length(way)) from planet_osm_roads where surface='asphalt' and ST_Within(way, (select multipolygon from krakow limit 1));
Expand|Select|Wrap|Line Numbers
- select count(*) from planet_osm_point where amenity='beater' and ST_Within(way, (select multipolygon from krakow limit 1));
Expand|Select|Wrap|Line Numbers
- select ST_distance((select way from planet_osm_point where amenity = 'university' and name ilike '%Wydział Matematyki i Informatyki%'), (select way from planet_osm_point where amenity = 'restaurant' and name ilike '%malina%'));
Expand|Select|Wrap|Line Numbers
- select amenity, count(*) from planet_osm_point where ST_distance((select way from planet_osm_point where name ilike '%malina%' and amenity = 'restaurant'), way) <= 10000 group by amenity order by 2 desc;
Expand|Select|Wrap|Line Numbers
- select name, sum(ST_length(way)) from planet_osm_roads where highway = 'primary' and name is not null and name not ilike '%powiat%' and name not ilike '%województwo%' and name not ilike '%subregion%' and name not ilike '%Kraków%' and ST_within(way, (select multipolygon from krakow limit 1)) group by name order by 2 desc limit 10;
Expand|Select|Wrap|Line Numbers
- select name, sum(ST_length(way)) from planet_osm_roads where highway = 'pedestrian' and name is not null and name not ilike '%powiat%' and name not ilike '%województwo%' and name not ilike '%subregion%' and name not ilike '%Kraków%' and ST_within(way, (select multipolygon from krakow limit 1)) group by name order by 2 desc limit 1;
Expand|Select|Wrap|Line Numbers
- select amenity, count(*) from planet_osm_point where (ST_distance((select way from planet_osm_point where name ilike '%malina%' and amenity = 'restaurant'), way) <= 10000 and st_distance((select way from planet_osm_point where name ilike '%szara ges%' and amenity = 'restaurant'), way) <= 5000) group by amenity order by 2 desc;
Expand|Select|Wrap|Line Numbers
- select name, ST_distance(way, (select way from planet_osm_point where name ilike '%muzeum sukiennice%')) from planet_osm_point where amenity = 'theatre' and st_distance(way, (select way from planet_osm_point where name ilike '%muzeum sukiennice%')) <500000 and not ST_Within(way, (select multipolygon from krakow limit 1));
Expand|Select|Wrap|Line Numbers
- select a.name, ST_distance(ST_setSRID(a.way, 4326), ST_GeomFromText('POINT(19.938333 50.061389)', 4326)) from planet_osm_polygon as a where historic ilike '%castle%'order by 1;
Expand|Select|Wrap|Line Numbers
- select name, sum(st_area(way)) from planet_osm_polygon where water = 'lake'and name is not null group by name order by 1;
Expand|Select|Wrap|Line Numbers
- select name, sum(st_area(way)) from planet_osm_polygon where water = 'lake'and name is not null and ST_Within(way, (select multipolygon from krakow limit 1)) group by name order by 1;
Expand|Select|Wrap|Line Numbers
- select sum(st_area(way)) from planet_osm_polygon where (wood ilike '%coniferous%') or (wood ilike 'mixed') or (wood ilike '%evergreen%') or (wood ilike '%deciduous%') and ST_Within(way, (select multipolygon from krakow limit 1));
Expand|Select|Wrap|Line Numbers
- select count(*) from planet_osm_roads as a, planet_osm_roads as b where a.surface = 'asphalt' and b.surface='asphalt' and a.osm_id != b.osm_id and st_length(b.way) < 100 and st_length(a.way) < 100 and st_crosses(a.way,b.way);