full_text_index.md 706 字节
Newer Older
M
Mars Liu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# 全文索引

Shop 表的部分字段如下:

```mysql
create table shop (
    id int primary key auto_increment,
    description varchar(8000)
      -- ...
)
```

现在 Joe 要给 description 字段加上全文索引,他应该怎么做?

M
Mars Liu 已提交
15 16
点击进入[MySQL实战练习环境](https://mydev.csdn.net/product/pod/new?image=cimg-centos7-skilltreemysql&connect=auto&create=auto&utm_source=skill)

M
Mars Liu 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
## 答案

```mysql
alter table shop add fulltext(description);
```

## 选项

### A

```mysql
alter table shop add index fulltext(description);
```

### B

```mysql
alter table shop create fulltext(description);
```

### C

```mysql
alter table shop alter description add fulltext(description);
```