MySQL/POINT:修订间差异
来自康健生活
< MySQL
| 第21行: | 第21行: | ||
Records: 2 Duplicates: 0 Warnings: 0 | Records: 2 Duplicates: 0 Warnings: 0 | ||
</pre>}}}} | </pre>}}}} | ||
添加数据还可以使用其他语句。 | |||
<syntaxhighlight lang="mysql"> | |||
SET @tempdata = 'POINT(100 100)'; | |||
INSERT INTO `test-location`(location, text) VALUES ( | |||
ST_GeomFromText(@tempdata), | |||
'测试点3' | |||
); | |||
/** or **/ | |||
SET @tempdata = ST_GeomFromText('POINT(100 100)'); | |||
INSERT INTO `test-location`(location, text) VALUES ( | |||
@tempdata, | |||
'测试点4' | |||
); | |||
</syntaxhighlight> | |||
2022年8月9日 (二) 09:48的版本
测试数据
mysql 之后的版本,空间数据类型的操作函数在命名上统一在前面加上
ST,如 GeomFromText 改为 ST_GeomFromText。创建测试表和字段。
添加数据还可以使用其他语句。
SET @tempdata = 'POINT(100 100)';
INSERT INTO `test-location`(location, text) VALUES (
ST_GeomFromText(@tempdata),
'测试点3'
);
/** or **/
SET @tempdata = ST_GeomFromText('POINT(100 100)');
INSERT INTO `test-location`(location, text) VALUES (
@tempdata,
'测试点4'
);
No categories