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;

  • 怎么打开php网站数据库
  • 如何在vmware虚拟机安装RedHat红帽5Linux系统
  • CSDN应用怎么设置使用暗黑模式?
  • 学校网站进不去怎么办
  • word入门基础 新建窗口使用方法
  • 热门搜索
    毛孔粗大怎么办 单身证明怎么开 蓝牙音箱怎么连接手机 queen怎么读 年糕怎么做好吃 铁蛋白高是怎么回事 傍怎么组词 东方为什么红 领结怎么打 中药怎么熬