1. Scott Roberts
  2. Valentina Database ADK
  3. Wednesday, July 11 2018, 06:59 PM
  4.  Subscribe via email
Is it possible to create a check constraint for a table that references a link? I have a 1:M binary link between two tables and would like a field in the child table to be unique within the parent record (it does not need to be unique within the table).

If I were using foreign keys, I would create a check constraint on the concatenation of the parent table key and the child table field.

I've attached a sample database with sample data.

I would like to create a check that ensures that the name field in the Rooms table is unique within the record in the Houses table to which it is linked.

Can this be done with a check constraint or do I need to check for this programmatically?
Attachments (1)
Comment
There are no comments made yet.
Ruslan Zasukhin Accepted Answer
Hi Scott,

CHECK works only for the current record.

I think when you mention {FK + name} you mean UNIQUE constraint actually, which builds an additional index for the whole table.

You could do this with ObjectPtr field (also 1 : M) the same as with FK,
but with Binary Link ... this is a good question. We will think about it.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories