天天看點

Java設定mysql字段為null_mysql中的desc表說Null是否但預設為NULL?

我正在使用mysql進行項目 . 當我執行'desc table_name'時,我看到表格輸出顯示字段的'Null'設定為'No',但是'Default'設定為'NULL' . 如何一個字段沒有Null但預設為Null本身?

mysql> desc users;

+-----------------+------------------+------+-----+----------------------------+----------------+

| Field | Type | Null | Key | Default | Extra |

+-----------------+------------------+------+-----+----------------------------+----------------+

| id | int(10) unsigned | NO | PRI | NULL | auto_increment |

| created_at | timestamp | YES | | NULL | |

| updated_at | timestamp | YES | | NULL | |

| email | varchar(255) | NO | | NULL | |

| password | varchar(255) | NO | | NULL | |

| remember_token | varchar(100) | YES | | NULL | |

| profile_pic | varchar(255) | YES | | img/profile/profilepic.jpg | |

| activation_code | varchar(255) | YES | UNI | NULL | |

| status_id | int(10) unsigned | NO | MUL | 1 | |

| profile_id | int(10) unsigned | YES | MUL | NULL | |

+-----------------+------------------+------+-----+----------------------------+----------------+

10 rows in set (0.00 sec)

謝謝,J . Sethi