Lesson 4: Creating a foreign key

Use the following procedure to use foreign keys to create relationships between tables.

 Create a foreign key
  1. In the left pane of Sybase Central, double-click Tables.

  2. In the left pane, click the SalesOrderItems table to select it.

  3. In the right pane, click the Constraints tab.

  4. Click File » New » Foreign Key.

  5. In the To Which Table Do You Want This Foreign Key To Refer list, click the Products table.

  6. In the What Do You Want To Name The New Foreign Key field, type ProductIDkey.

  7. Click Next and for Do You Want This Foreign Key To Reference The Primary Key Or A Unique Constraint click Primary Key.

  8. In the Foreign Column list, click SalesOrderItemsID.

  9. Click Finish.

 See also