数据库原理与应用第三版何玉洁第五章上机练习答案 您所在的位置:网站首页 数据库原理与应用教程课后答案何玉洁 数据库原理与应用第三版何玉洁第五章上机练习答案

数据库原理与应用第三版何玉洁第五章上机练习答案

2024-07-08 17:02| 来源: 网络整理| 查看: 265

在这里插入图片描述 1 create table book( Bno char(6) primary key, Bname varchar(30) not NULL, Fauthor char(10) not NULL, Pubtime smalldatetime, Price decimal(3,1), ) 2 create table bookstore( Stono char(6) primary key, Stoname varchar(30) not NULL, Tel char(8) check (tel like ‘[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]’), Ad varchar(40), Postcode char(6), )

3 create table sell( Bno char(6) not NULL, Stono char(6) not NULL, Stime smalldatetime not NULL, Sno tinyint check (Sno >= 1), Primary key(Bno,Stono,Stime), foreign key (Bno) references book(Bno), foreign key (Stono) references bookstore(Stono) ) 2) alter table book add printnum int check(printnum>=1000)

3) alter table bookstore drop column Postcode

4) alter table sell drop constraint CK__sell__Sno__398D8EEE(这个是我电脑自动的约束名)

alter table sell alter column Sno int

alter table sell add constraint sellcheck check(Sno >=1) 这里如果只用第二个命令会报错在这里插入图片描述 我们去掉约束,再改,然后再添加约束即可 改成我们自定义的约束名,不是系统随机的之后,再更改就不会报错了



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有