mysql使用sql语言创建非空属性的表
mysql中怎样创建霹葺檠溥非空属性的表,也可以在php中使用mysql的sql命令来完成:
首先我们来创建一个带有非空属性的表:
create table example4(
id int not null primary key,
stu_id int not null,
course_id int,
constraint s_f foreign key(course_id) references example2(course_id)
);
这里说明一下创建非空属性的结构与含义:
结构是:属性名 属性类型 not null;
比喻这里的: id int not null primary key,
还可以使用一个命令来修改已经创建好的表的属性,使它变为具有非空属性的如:
alter table example4 changed course_id int not null;
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:67
阅读量:56
阅读量:28
阅读量:81
阅读量:57