ALTER TABLE Employees ADD COLUMN Salary CHAR(20),如何让Salary可以为空字符串?

解决方案 »

  1.   

    ALTER TABLE Employees ADD Salary CHAR(20) null
      

  2.   

    ALTER TABLE Employees ADD Salary CHAR(20) default('')
      

  3.   

    create table test (id int)
    alter table test add aa char(4) null 
    insert test(id) values(1)
    alter table test add bb char(4) null default('')
    insert test(id) values(2)
    select * from testid          aa   bb   
    ----------- ---- ---- 
    1           NULL NULL
    2           NULL     (所影响的行数为 2 行)
      

  4.   

    alter table test add aa char(4) null 
    alter table test add bb char(4) null default('')