接着入门1生成的表 studnet,teacher,test_course,score
将student表中的student_id设置为“主键”
alter table student add primary key(student_id)
设置外键:test_score表中的student_id参照student表中的student_id,test_id参照test表中的test_id;、
alter table test_score add constraint fk_sid foreign key(studnet_id) references studnet(studnet_id)
在student表中添加专业列institute,最长是10个汉字,不允许为空,默认值为“计算机软件”;
alter table student add institute char(10) not null default 'cs'
修改student表中列sex上的默认值为‘女’;
alter table student modify(sex default'女')
在teacher表中添加约束,工作时间必须大于生日;
alter table teacher add constraints ck_date check(workdata>birthdata)
如对本文有疑问, 点击进行留言回复!!
Oracle查询用户,表结构,表索引,存储过程,触发器等信息整理
oracle的自连接、内连接、外连接、交叉连接、自然连接、等值连接、不等值连接
Oracle数据库使用replace函数批量删除数据中的双引号
网友评论