怎样用SQL语句创建一个空值为0的字段?

来源:百度知道 编辑:UC知道 时间:2024/06/14 00:32:14
请高手指点,不知道是不是这样?
create table class
(student_num smallint not null,0
)

create table class
(student_num smallint not null default(0)
)

这个的意思是省缺值是0
eg. create table t_name
( f1 smallint not null default(0),
f2 smallint);
insert t(f2)
values(5);
结果有条记录f1=0;f2=5