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

 时间:2026-02-14 09:36:04

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入门基础 新建窗口使用方法
  • 热门搜索
    吃火锅配什么菜 家用电烤箱什么牌子好 c票能开什么车 莫须有是什么意思 各司其职的意思 什么手游好玩不花钱 destiny什么意思 什么是报关员 人满为患的意思 贯彻的意思