![](/img/trans.png)
[英]How do I use mySQL to select results which have a maximum value for one column, grouped by another column?
[英]How do I change the column of a MySQL to have another default value?
現在,服務器的默認值為1。如何將其更改為0?
當前是此列:
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
friend_posting | tinyint(1) | NO | | 1 | |
它沒有外鍵或任何東西。
http://dev.mysql.com/doc/refman/5.1/en/alter-table.html
ALTER TABLE table_name
ALTER COLUMN friend_posting
SET DEFAULT 0
當然,這不會改變現有的行; 他們將需要明確更新。 它僅為新行設置默認值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.