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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:44:06
Original
1118 people have browsed it

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
Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
Update one column of data in the table
From 1970-01-01 08:00:00
0
0
0
Optimize table indexes in MySQL
From 1970-01-01 08:00:00
0
0
0
Why can't the list be rendered?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template