简体   繁体   中英

How to Change Default Null to NOT NULL in MySQL

I have the following column in table room Now I want to change the definition of column property_id from NULL to NOT NULL How can I do this following Query is not working

ALTER TABLE `room` CHANGE `property_id` `property_id` bigint(20)  NOT NULL;

Actual definition of Column is :

 `property_id` bigint(20) DEFAULT NULL,

在 mysql 中,您可以实现这一点,

ALTER TABLE room MODIFY property_id bigint(20) not null;

我的查询非常好,唯一的错误是有些行包含空记录,因此为什么会产生问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM