Ask Your Question

I need to create a duplicate Table in the Relationships window of LibreBase

asked 2019-05-14 14:58:28 +0200

Sums gravatar image

updated 2019-05-14 15:00:53 +0200

I have a Table in Base named Airports. Its PK field is named Airport_ICAO_Code

I have another Table named Routes. It is a Many to Many Table and has two Fields. They are DepartureAirportICAO and DestinationAirportICAO.

I need to use the Airport_ICAO_Code field in the Airports Table as a FK for both Fields in the Routes Table.

I can do this in Sql Server by creating a Duplicate Airports Table in the Relationships Window but Im not allowed to create a duplicate in Base.

How can I solve this.

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-05-14 17:52:26 +0200

Ratslinger gravatar image


With many-to-many use an intermediate table. See this post -> Should I use a separate table?

edit flag offensive delete link more


The Routes table is an Intermediate table. The problem is both FKs have to come from the same Airport_ICAO_Code fileld in the Airports table

Sums gravatar imageSums ( 2019-05-14 19:06:34 +0200 )edit

Did you look at the link? Intermediate table should have its own Primary key - don't see that in your table. Am I missing something?

Ratslinger gravatar imageRatslinger ( 2019-05-14 19:21:24 +0200 )edit

I looked at the link. My Routes table should have two FKs. The combination of these is Unique and would be a Composite PK.

Sums gravatar imageSums ( 2019-05-14 19:27:38 +0200 )edit

Sorry, up most of the night and not thinking quite clear. Have you tried establishing the FK using SQL? Relationship dialog not always the best.

Ratslinger gravatar imageRatslinger ( 2019-05-14 19:34:46 +0200 )edit

I had posted this just as you posted. Can I show you in a screenshot, Ive added a RouteID PK but I still have the same problem with the Fks. I haven't tried sql yet. Don't know how in Libre.

Sums gravatar imageSums ( 2019-05-14 19:37:28 +0200 )edit

You can add a screen - edit question and use toolbar. First did you see my comment on SQL?

Just saw last addition - need a minute to look up. Foreign key, see this post -> "Trips and Accommodation” need advice on table structure and relations in DB.

Ratslinger gravatar imageRatslinger ( 2019-05-14 19:49:06 +0200 )edit

Not sure what you mean by adding a screen. I solved the problem by creating a DepartureAirport Table and a DestinationAirport Table. It will mean that I will have to update both tables instead of just updating an Airports Table. Trying to create a duplicate table just lead to a lot of messy sql code. Thanks for your help with this and other questions.

Sums gravatar imageSums ( 2019-05-15 13:47:42 +0200 )edit

@Sums You are the one who mentioned showing a screenshot. Just noted on how to do what you asked.

Have no idea why you would duplicate the table. Have never needed to do that. Link displayed an example.

Ratslinger gravatar imageRatslinger ( 2019-05-15 17:42:22 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-05-14 14:58:28 +0200

Seen: 23 times

Last updated: May 14