简体   繁体   中英

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 在此处输入图像描述

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.

在此处输入图像描述

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM