You are given a table containing points on a 1D coordinate axis (the x-axis). Your goal is to find the shortest distance between any two distinct points.
The distance between two points x1 and x2 is defined as the absolute value of their difference: |x1 - x2|.
| x(INTEGER) |
|---|
| -1 |
| 0 |
| 2 |
| x(INTEGER) | label(VARCHAR) |
|---|---|
| -1 | A |
| 0 | B |
| 2 | C |
| axis_id(INTEGER) | axis_name(VARCHAR) |
|---|---|
| 1 | Horizontal |
| shortest(INTEGER) |
|---|
| 1 |