Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

mysql - How do I reset a column to its default in a sql table?

I created a mysql table using the code:

CREATE TABLE `slide_patch_features` 
(
    `patch_feature_id` bigint(20) NOT NULL AUTO_INCREMENT,
    `patch_id` bigint(20) NOT NULL,
    `patch_feature_file_path` varchar(256) DEFAULT NULL,
    PRIMARY KEY (`patch_feature_id`),
    UNIQUE KEY `IDX_slide_patch_features_01` (`patch_id`),
    KEY `FK_slide_patch_features_slide_patch` (`patch_id`),
    CONSTRAINT `FK_slide_patch_features_slide_patch` FOREIGN KEY (`patch_id`) REFERENCES 
    `slide_patch` (`patch_id`) ON DELETE CASCADE
);

I filled out the table. Now I want to reset just one column say 'patch_feature_file_path'. How do I do that?

I do not want to drop the entire table and create a new one as the other columns are useful to me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

update slide_patch_features set patch_feature_file_path = null


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...