David Thielen
David Thielen

Reputation: 33026

How do I set a PK:FK relationship in DB Browser for SQLite?

I'm in DB Browser for SQLite and I don't see any way to set a PK:FK relationship. Can it do that?

thanks - dave

Upvotes: 3

Views: 4021

Answers (2)

topsail
topsail

Reputation: 3130

On the theory that a picture is worth a hundred words, adding a screenshot here as well. As noted in the accepted answer from MikeT, you may have to scroll over a bit in the window where you are adding fields to the table.

enter image description here

I spent a lot of time trying to find a way to do this on the "constraints" tab that you see next in this picture, but could find now way of creating the constraint there - this seems a bug (you could almost add one, but there was no way to pick or set the other table that the foreign key "references").

Upvotes: 1

MikeT
MikeT

Reputation: 57073

When adding/editing the table Scroll right or enlarge the screen and then double-click the respective row underneath the Foreign Key heading. Select the Table and the column that the FK is to be comprised of.

Upvotes: 6

Related Questions