Skip to content

Instantly share code, notes, and snippets.

@afonsoaugusto
Last active January 29, 2018 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afonsoaugusto/9553640307990af093a3f3cb18f79b06 to your computer and use it in GitHub Desktop.
Save afonsoaugusto/9553640307990af093a3f3cb18f79b06 to your computer and use it in GitHub Desktop.
-- Inclusão no CREATE TABLE:
CREATE TABLE point_example (p POINT NOT NULL, SPATIAL INDEX(p));
-- Inclusão com ALTER TABLE:
drop table point_example;
CREATE TABLE point_example (p POINT NOT NULL);
ALTER TABLE point_example ADD SPATIAL INDEX(p);
--com CREATE INDEX:
drop table point_example;
CREATE TABLE point_example (p POINT NOT NULL);
CREATE SPATIAL INDEX g ON point_example (p);
mysql> desc point_example;
+-------+-------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------+------+-----+---------+-------+
| p | point | NO | MUL | NULL | |
+-------+-------+------+-----+---------+-------+
1 row in set (0.01 sec)
--com ALTER TABLE:
ALTER TABLE point_example DROP INDEX g;
--com DROP INDEX:
DROP INDEX g ON point_example;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment