mysql 主鍵自增長並且設定預設值,mysql預設值

來源:互聯網
上載者:User

mysql 主鍵自增長並且設定預設值,mysql預設值

CREATE TABLE `ecm_address` ( `addr_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL DEFAULT '0', `consignee` varchar(60) NOT NULL DEFAULT '', `region_id` int(10) unsigned DEFAULT NULL, `region_name` varchar(255) DEFAULT NULL, `address` varchar(255) DEFAULT NULL, `zipcode` varchar(20) DEFAULT NULL, `phone_tel` varchar(60) DEFAULT NULL, `phone_mob` varchar(60) DEFAULT NULL, PRIMARY KEY (`addr_id`), KEY `user_id` (`user_id`)) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8你注意這段建立表的mysql語句,在最後一行有個:AUTO_INCREMENT=2,這個表示建好表之後,自動成長是從2開始的,如果=10,那麼是從10開始的。明白了吧,有用的話請給分,謝謝!

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.