输入:
CREATE TABLE dist
-> SELECT ST_DISTANCE(POINT(x1,y1),POINT(x2,y2))
-> FROM config;
输出:
+------------------------------------------+
| ST_DISTANCE(POINT(x1,y1) , POINT(x2,y2)) |
+------------------------------------------+
| 140.0071426749364 |
| 139.30183056945089 |
| 138.6001443000692 |
| 137.90213921473443 |
| 137.20787149431334 |
+------------------------------------------+
重命名列输入
> ALTER TABLE dist
-> RENAME COLUMN ST_DISTANCE(POINT(x1,y1),POINT(x2,y2)) TO Values;
错误:1064 (42000):您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 2 行的 '(POINT(x1,y1),POINT(x2,y2)) TO Values' 附近使用正确的语法