工大后院

 找回密码
 加入后院

扫一扫,访问微社区

QQ登录

只需一步,快速开始

搜索
查看: 1938|回复: 2

求助SQL问题

[复制链接]
发表于 2010-4-1 20:29 | 显示全部楼层 |阅读模式
create table s1
(sno char(8) not null,
sname char(10),
ssex char(2)
)
alter table s1
add constraint pk_sno primary key(sno)
alter table s1
add constraint uk_cno unique(sname)
alter table s1
add constraint df1_ssex default'男'for ssex
create table c1
(sno char(8) not null,
cno char(8) not null,
score int
)
alter table c1
add constraint pk_c1 primary key(sno)
alter table c1
add constraint pk_c2 primary key(cno)
alter table c1
add constraint fk_sno foreign key references s1(sno)
alter table c1
add constraint score_chk check(score>=0 and score<=100)

执行后出现
消息 8139,级别 16,状态 0,第 22 行
表 'c1' 的外键中引用列的数目与被引用列的数目不等。
发表于 2010-4-2 16:50 | 显示全部楼层
alter table c1
add constraint pk_c1 primary key(sno)
alter table c1
add constraint pk_c2 primary key(cno)
alter table c1
-------------------------》how could one table has two primary key??
回复

使用道具 举报

发表于 2010-4-2 16:53 | 显示全部楼层
As far as i know that one table having two primary key  could never happen in Oracle!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入后院

本版积分规则

QQ|Archiver|手机版|小黑屋|广告业务Q|工大后院 ( 粤ICP备10013660号 )

GMT+8, 2024-4-29 07:23

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表