Link to home
Start Free TrialLog in
Avatar of sonicefu
sonicefuFlag for Pakistan

asked on

How to solve the following problem ?

Hi,

Can anyone provide me help to to solve the following ? or just give me pointer that how to solve it please ?

Given n tables, R1, R2, …, Rn, such that the foreign key of table R2 references to the primary key of table R1 (RIC2), the foreign key of table R3 references to the primary key of table R2 (RIC3), …., the foreign key of table Rn references to the primary key of table Rn-1 (RICn), and the foreign key of table R1 references to the primary key of table Rn (RIC1).

1. Please describe how to create tables R1, …, Rn and to enforce all the referential integrity constraints RIC1, RIC2, …, RICn.
2. Please describe how to populate the data into tables R1, …, Rn.


Best Regards
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

sonicefu, this looks very much like a homework problem, and unfortunately, EE Experts are not permitted to do homework problems for people.

If you have a specific question, you are welcome to ask it, and we can maybe help you with that.
Avatar of sonicefu

ASKER

Let me explain it simple words that what I need.

I just want to know that how can I implement recursive relationships between tables as for as CREATE TABLE and UPDATE TABLE is concerned ?

This is my simple requirement, can you provide me simple hint to solve it ?
ASKER CERTIFIED SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks rrjegan17,

Can you elaborate a bit please
3. Update (foreign key of table R1 to table Rn) column with the actual value..

actually here Rn is referencing to R1 not opposite one

Is there specific SQL to use in the scenarios like this (MS-SQL)
>> actually here Rn is referencing to R1 not opposite one

Ok, Got it the other way..
In that case, you need to have R1 table inserted first before Rn

>> Is there specific SQL to use in the scenarios like this (MS-SQL)

Nothing specific, just follow the order in which the Foreign keys references..
Or in other words, Parent tables first and then the Child tables.
thanks a lot rrjegan17 !
Welcome sonicefu
Kindly let me know if you have any other doubts..
I'll come with examples.

Should I close this Question by giving you points and I'll ask a new question for more details ?
If you feel those examples are related to this question, then you can keep it open..
Else close this question and open up a new question as required..
Thanks a lot !