Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #16 first 3 character of nth smallest/largest country and its cities
- SELECT SUBSTR(country, 1, 3), COUNT(city) Cities
- FROM citytable
- GROUP BY country
- ORDER BY Cities ASC LIMIT 1, 1;
- #17 Delete data where name of city starts or ends with specified character or lat/lon between some values
- DELETE FROM citytable
- WHERE city RLIKE "[nugi]$" OR city RLIKE "^[^wx]" OR
- lat BETWEEN 121.5 AND 125.5 AND lon BETWEEN 25.3 AND 25.5;
- #18 Swap(lat, lon) if last number of ID is m
- UPDATE citytable
- SET lat = lat + lon, lon = lat-lon, lat = lat - lon WHERE id % 10 = 4;
- #19 Euclidean distance between smallest lat, lon and largest lat, lon
- SELECT ROUND(SQRT(POW(MAX(lat) - MIN(lat), 2) + POW(MAX(lon) - MIN(lon), 2)), 4)
- FROM citytable;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement