[英]SQL: Unique and Foreign key of a column from other table's column which itself is neither Unique nor Primary key
I have a column which in neither unique nor primary key in a table.我有一列既不是唯一的也不是表中的主键。 But i want that be be as a foreign key as well as unique in other table column
但我希望它作为外键以及在其他表列中是唯一的
eg例如
Table_1 as below which has a column_whichIsNeitherUniqueNorPK Table_1 如下,其中有一个column_whichIsNeitherUniqueNorPK
Now i have Table_2 which has a column " FK_column_whichIsNeitherUniqueNorPK " in which i want this columns values as Foreign key of above table, and this column should be Unique.现在我有 Table_2,它有一个列“ FK_column_whichIsNeitherUniqueNorPK ”,我希望这些列值作为上表的外键,并且该列应该是唯一的。
so as per comments, it looks like it is not possible directly as it deviates from relational theory.因此,根据评论,它看起来不可能直接,因为它偏离了关系理论。 For a column to be Foreign key, the other column has to be unique
对于要成为外键的列,另一列必须是唯一的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.