Home > Database > Mysql Tutorial > How to modify the default value of a column in mysql

How to modify the default value of a column in mysql

王林
Release: 2020-10-13 16:31:42
Original
13112 people have browsed it

How to modify the default value of a column in MySQL: directly execute the [alter table table name alter column field name set default default value;] statement to modify the default value.

How to modify the default value of a column in mysql

If there is a default value, delete it first

(recommended tutorial: mysql video tutorial)

alter table表名alter column字段名drop default;
Copy after login

Then set the default value (if it does not exist, you can set it directly)

alter table表名 alter column字段名 set default默认值;
Copy after login

Related recommendations: mysql tutorial

The above is the detailed content of How to modify the default value of a column in mysql. For more information, please follow other related articles on the PHP Chinese website!

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