Home >Database >Mysql Tutorial >mysql增加列修改列名列属性以及删除列_MySQL

mysql增加列修改列名列属性以及删除列_MySQL

WBOY
WBOYOriginal
2016-06-01 13:44:061114browse

bitsCN.com

 

首先推荐一本初学者的书,一个小册子:《mysql必知必会》简介实用,权威;有点贵,昨天才买的。

http:///ebook/201112/30389.html

正文:

 

mysql修改表名,列名,列类型,添加表列,删除表列

修改表名(设表明为testtable,将其命名为newtablename)

alter table  testtable rename newtablename;

添加表列:

alter table testtable add  column name varchar(40);

删除列:

alter table testtable  drop  column name;

修改列的类型:

alter table testtable modify address char(40)

或者这样:alter table testtable change address address  char(40)

 

修改表列名

alter table testtable change  column address address1 varchar(30)

 

作者 naturebe

bitsCN.com
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