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 book_id field in the loans table to the book_id in the books table. As soon as you start dragging a line will appear.
  3. When you reach the books table release the mouse. The line should remain visible between the two fields
  4. 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
  5. 5 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.
  6. 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 →