SQLEditor Icon

Making foreign key relations

The next step is to link the tables together with foreign key relationships.

  1. Look for the tables books and loans. Move them until they are both visible and do not overlap.
  2. Using the mouse drag from the middle of the book_id field in the loans table to the book_id field in the books table.
    Do not start the mouse drag inside the gray control handle on the the left side of the field, because that will move the whole field instead
  3. As soon as you start dragging a line will appear. Move the mouse pointer up towards the the books_id field in the books table.
  4. When you reach the books_id field release the mouse. The line should remain visible between the two fields
  5. If the line disappears when you release the mouse, try again and make sure you don't release the mouse until you pointer is directly over the target field
  6. You should see a icon F appear on the loans(book_id) field. This indicates that it is a foreign key and references another field elsewhere.
  7. Next make a foreign key relationship between loans(borrow_id) and
    borrower(borrower_id)

Your diagram should now look like this:

← Previous Step
Next Step →