Home > Database > Mysql Tutorial > MySql增加字段、删除字段、修改字段名称、修改字段类型_MySQL

MySql增加字段、删除字段、修改字段名称、修改字段类型_MySQL

WBOY
Release: 2016-06-01 13:40:49
Original
1441 people have browsed it

bitsCN.com
MySql增加字段、删除字段、修改字段名称、修改字段类型 MySql的简单语法,常用,却不容易记住。当然,这些Sql语法在各数据库中基本通用。下面列出: 1.增加一个字段alter table user add COLUMN new1 VARCHAR(20) DEFAULT NULL; //增加一个字段,默认为空alter table user add COLUMN new2 VARCHAR(20) NOT NULL;  //增加一个字段,默认不能为空     2.删除一个字段alter table user DROP COLUMN new2;   //删除一个字段 3.修改一个字段alter table user MODIFY new1 VARCHAR(10);  //修改一个字段的类型 alter table user CHANGE new1 new4 int;  //修改一个字段的名称,此时一定要重新指定该字段的类型 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template