How to put UNIQUE constraint and foreign key constraint

How to put UNIQUE constraint and foreign key constraint

Rahul Rai -
回帖数:4

Hi

I want to create a table through XMLDB editor. I have a one column. In column, i want to put UNIQUE constraint and foreign key constraint, How it is possible. because after create foreign key constraint than i want to create UNIQUE constraint, that is showing error

Save key

This field is used as key.

回复Rahul Rai

Re: How to put UNIQUE constraint and foreign key constraint

William Lu -
Particularly helpful Moodlers的头像

You posted into a wrong forum, moving to General help forum now.

回复Rahul Rai

Re: How to put UNIQUE constraint and foreign key constraint

Marcus Green -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像

Moodle discards pk/fk relationships during the installation process so they are mainly of use for documentation rather than actually enforcing referential integrity. Some of the links off this page cover this issue

http://www.examulator.com/er/

回复Marcus Green

Re: How to put UNIQUE constraint and foreign key constraint

José de Jesús -

Hello, Marcus Green:

Excellent!

Thank you very much. This helps us to better understand how database tables are related.

Regards,

José de Jesús.

回复Rahul Rai

Re: How to put UNIQUE constraint and foreign key constraint

Deepak Gour -

Hi Rahul

I understand your problem.

I think you want to put two constraint (UNIQUE constraint and foreign key constraint) in one column through XMLDB.

If you see properly last option.

there is showing "foreign-unique".

Key

You can select both key on one time.

I hope it is helpful.