# 几何索引 Goods 数据库中有一个 shop 表,其中包含如下字段: ```mysql create table shop ( id int primary key auto_increment, location GEOMETRY -- ... ) ``` 现在 Joe 要给 location 字段加上几何索引,他应该怎么做? ## 答案 ```mysql alter table shop modify location GEOMETRY not null; alter table shop add INDEX geo_index(location); ``` ## 选项 ### A ```mysql alter table shop add INDEX geo_index(location); ``` ### B ```mysql alter table shop add INDEX location; ``` ### C ```mysql alter table shop modify location GEOMETRY not null; alter table shop add INDEX location; ``` ### D ```mysql alter table shop modify location GEOMETRY not null; alter table shop add INDEX location; ```