How to update column with null value

前端 未结 13 651
被撕碎了的回忆
被撕碎了的回忆 2020-12-13 05:08

I am using mysql and need to update a column with a null value. I have tried this many different ways and the best I have gotten is an empty string.

Is there a speci

13条回答
  •  隐瞒了意图╮
    2020-12-13 05:50

    No special syntax:

    CREATE TABLE your_table (some_id int, your_column varchar(100));
    
    INSERT INTO your_table VALUES (1, 'Hello');
    
    UPDATE your_table
    SET    your_column = NULL
    WHERE  some_id = 1;
    
    SELECT * FROM your_table WHERE your_column IS NULL;
    +---------+-------------+
    | some_id | your_column |
    +---------+-------------+
    |       1 | NULL        |
    +---------+-------------+
    1 row in set (0.00 sec)
    

提交回复
热议问题