该错误消息是什么意思,如何解决? [英] What this error message mean and How to solve it ?

查看:85
本文介绍了该错误消息是什么意思,如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了这三个表,其中一个是
部门(dep_no int PK,dep_name nvarchar),-LEVEL的父表
第二个表是LEVEL(lvl_dep_key int PK,dep_no int FK& PK,lvl_id nvarchar Pk)-课程的父表&部门的子表
我将lvl_dep_key用作lvl_id和dep_no列的超级键
将其与子表相关联,而不是将lvl_id和dep_no列都与这些表相关联

第三张表是课程(lvl_dep_key int FK& PK,cors_id nvarchar PK,cors_name nvarchar,price money)-LEVEL的子表

因此,当我尝试通过这些列(LEVEL表的lvl_dep_key和Courses表的lvl_dep_key)在LEVEL表和课程表之间建立关系时,收到此错误消息"表[LEVEL]中的列与现有的主键或UNIQUE约束",我用Google搜索了一下是什么意思,但没有任何好处.所以有什么可以帮助我解决这个问题plzzzzzzzzzz.谢谢

Hi, i create these three tables one is
department(dep_no int PK , dep_name nvarchar ), -- parent table of LEVEL
second table is LEVEL(lvl_dep_key int PK , dep_no int FK & PK , lvl _id nvarchar Pk) -- parent table of courses & the child table of department
i make the lvl_dep_key as a super key for both lvl_id and dep_no columns
to relate it to the children tables instead of taken both lvl_id and dep_no columns to these tables

third table is courses( lvl_dep_key int FK & PK , cors_id nvarchar PK, cors_name nvarchar,price money) -- the child table of LEVEL

so when i tried to create the relationship between LEVEL table and courses table by these columns which is (lvl_dep_key of LEVEL table , and lvl_dep_key of courses table i get this error message " the columns in table [LEVEL] do not match an existing primary key or UNIQUE constraint ", i googled to know what it''s mean but no benefit . so can any help me to solve this problem plzzzzzzzzzz. thanks

推荐答案

如果级别是父表,并且每门课程都有一个父行,
那么子行应指向父表中作为主键的所有列,否则它将行不通.

它看起来像是循环引用,但是,我不确定您到底想做什么.
If level is the parent table, and every course has one Parent row,
then the child row should point to ALL the columns that are primary key in the parent table, otherwise it won''t work.

It looks like a circular reference but, i''m not sure, what exactly your''e trying to do.


这篇关于该错误消息是什么意思,如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆