Is it possible to insert into two separate databases?
Is it possible to insert into two separate databases?
Hello,
So I am working with an application in which a user enters a cohort name, along with a group name. Each cohort can hold multiple groups, which is linked in the database by a foreign key in the group table. I wan't to insert both the cohort name and group name in their respective tables. At the moment I only can get the cohort to insert and not the group. Is it possible to do this without making a separate file for it?
This question has an accepted answers - jump to answer
Answers
Is this a one-to-one relationship? Can you show me your SQL schema?
Thanks,
Allan
Hi Allan,
sorry for the delayed response. Bellow is some of the stuff that could help you. As for the one-to-one relationship, I think no as a Cohort can be associated with multiple groups, but a group can only be associated with one cohort. Hopefully what I provided helps and if you need anything else let me know.
SQL Tables for Group and Cohort, note some items are test data
The Model that would insert into the two tabels
If I've understood correctly (apologies if not!) this example I think will be of interest.
My understanding is that you want to show a table of groups, a table of study cohorts and have the ability to assign groups into each cohort. Is that correct?
If so, I would have a separate DataTable for maintaining the groups. I'd also have a separate "group" database table, since at the moment you might have duplicate information for the groups. Then
study_group
can be a trivial link table like in the example.Regards,
Allan