MYSQL: How to make NULL or empty data default to 0 during insert

前端 未结 5 2645
走了就别回头了
走了就别回头了 2021-02-20 01:07

So this seems like it would be pretty straight forward and I swear I\'ve done this before, but for some reason it\'s just not working for me.

I am using MAMP

5条回答
  •  星月不相逢
    2021-02-20 01:20

    You can use the default keyword to get the default value of the column during insertion.

    Example :

    INSERT INTO listings(ListingID, BathsFull) VALUES (2,DEFAULT);
    

提交回复
热议问题