手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

mysql使用sql语言创建非空属性的表

时间:2024-10-13 21:26:50

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;

© 手抄报圈