How to put UNIQUE constraint and foreign key constraint

How to put UNIQUE constraint and foreign key constraint

by Rahul Rai -
Number of replies: 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.

Average of ratings: -
In reply to Rahul Rai

Re: How to put UNIQUE constraint and foreign key constraint

by William Lu -
Picture of Particularly helpful Moodlers

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

In reply to Rahul Rai

Re: How to put UNIQUE constraint and foreign key constraint

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of 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/

Average of ratings: Useful (1)
In reply to Marcus Green

Re: How to put UNIQUE constraint and foreign key constraint

by 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.

Average of ratings: Useful (1)
In reply to Rahul Rai

Re: How to put UNIQUE constraint and foreign key constraint

by 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.