为了账号安全,请及时绑定邮箱和手机立即绑定

明明输入了数据,为什么数据只能显示一行?

明明输入了数据,为什么数据只能显示一行?

不知道这么解决、、、create database [hdu] on   ( name = hdu,    filename = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\hdu.mdf' ,    size = 4 ,    maxsize = 100,    filegrowth = 10% )--表— use  hdu   create table Class  (   Clno Char(5)not null primary key ,   Speciality VarChar(20) not null,   Iyear Char(4) not null,   Number Integer check(Number>1 and Number<300),    Monitor Char(7) ) --1.Student 表-- create table Student  (   Sno Char(7)  primary key,   Sname VarChar(20) not null ,   Ssex  Char(2) not null check(Ssex='男' or Ssex='女' ) default '男',   Sage  Smallint check(Sage>14 and Sage<65),      Clno Char(5) not null foreign key references Class(Clno)    )insert into Class values ('00311','计算机软件','2000','120','2000101') insert into Class values ('00312','计算机应用','2000','140','2000103') insert into Class values ('01311','计算机软件','2001','220','2001103') go select * from Class
查看完整描述

3 回答

已采纳
?
相忘于江湖494

TA贡献19条经验 获得超10个赞

表建的有问题,你把表建的相对宽松点,约束都交给逻辑就行了,个人认为数据库就是存储数据的,没必要搞些逻辑,报错信息很明显,存在约束

查看完整回答
反对 回复 2017-12-06
  • qq_安安_17
    qq_安安_17
    不知道这么改,是on primary 导致的吗
  • 相忘于江湖494
    相忘于江湖494
    [SQL]insert into class values ('00311','计算机软件','2000',120,'2000101'),('00312','计算机软件','2000',120,'2000103'),('01311','计算机软件','2000',120,'2001103') 受影响的行: 3 时间: 0.029s
?
媛猿

TA贡献5条经验 获得超3个赞

表建得有问题

查看完整回答
1 反对 回复 2017-12-06
  • 3 回答
  • 1 关注
  • 2881 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信