Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Tutorial: Creating a SQL Anywhere Database

Lesson 4: Set column properties Next Page

Lesson 5: Create relationships between tables using foreign keys

In this lesson, you learn about creating relationships between tables using foreign keys.

For information about designing relationships, see Entities and relationships.

To create a foreign key
  1. In Sybase Central, open the Tables folder.

  2. Open the SalesOrders table.

  3. In the right pane of Sybase Central, click the Constraints tab.

  4. From the File menu, choose New > Foreign Key to open the Create Foreign Key wizard.

  5. Select the Customers table as the table to which you want the foreign key to refer, name the new foreign key CustomerID, and then click Next.

  6. Choose Primary key for the foreign key to reference.

    Select ID from the Foreign Column dropdown list, and then click Finish.

  7. Repeat steps 1 through 5 to create the following foreign keys:

This completes this introductory section on creating relational databases.

For more information on designing databases, see Entities and relationships.