Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
create table points(id int auto_increment, longtitude float, latitude float, date datetime, primary key(id)); insert into points(longtitude, latitude, date) values (55.833696, 37.560693, '2022-07-01 00:00:00'), (55.733696, 37.560693, '2022-07-02 00:00:00'), (55.633696, 37.560693, '2022-07-03 00:00:00'), (55.533696, 37.560693, '2022-07-04 00:00:00'), (55.433696, 37.560693, '2022-07-05 00:00:00'), (55.333696, 37.560693, '2022-07-06 00:00:00'), (55.233696, 37.560693, '2022-07-07 00:00:00'); explain select sum(distance) from (select ST_Distance_Sphere( point(points.longtitude, points.latitude), point( lead(longtitude) over( order by points.date), lead(latitude) over( order by points.date) ) ) as distance from points where date between '2022-07-01 00:00:00' and '2022-07-05 00:00:00' order by date asc) as t;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear