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



http://img.mukewang.com/5a2759a20001d33d06280349.jpg

不知道这么解决、、、

http://img2.mukewang.com/5a275a440001fdf006350131.jpg


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


qq_安安_17
浏览 2891回答 3
3回答

相忘于江湖494

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

媛猿

表建得有问题
打开App,查看更多内容
随时随地看视频慕课网APP