Home >Database >Mysql Tutorial >数据库外键与索引相关操作

数据库外键与索引相关操作

WBOY
WBOYOriginal
2016-06-07 14:54:001303browse

数据库外键与索引相关操作 删除外键 www.2cto.com alter table tablename drop foreign key keyname; 添加外键 alter table tablename add constraint foreign key(id) references parent(id); keyname可通过show index from tablename;查询 删除索引 drop i


数据库外键与索引相关操作

 

删除外键

  www.2cto.com  

alter table tablename drop foreign key keyname; 

 

添加外键

 

alter table tablename add constraint foreign key(id) references parent(id); 

 

keyname可通过show index from tablename;查询

 

删除索引

 

drop index keyname on tablename
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn