sql server 中,添加默认约束 比如  alter  table 表名  add  constraint  默任约束名  default  (getDate()) for  字段 ,在mysql中怎么实现呢??

解决方案 »

  1.   

    mysql> create table t_yanyufeng(
        ->  id int,
        ->  col timestamp default CURRENT_TIMESTAMP ()
        -> );
    Query OK, 0 rows affected (0.13 sec)
      

  2.   

    mysql> alter table t_yanyufeng modify id int default 100;
    Query OK, 0 rows affected (0.05 sec)
    Records: 0  Duplicates: 0  Warnings: 0mysql>
    建议参考一下MYSQL的文档MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html