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

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » SQL Anywhere database connections » Tutorial: Creating a SQL Anywhere database


Lesson 4: Creating a foreign key

Create foreign keys to create relationships between tables.


This lesson assumes that you have completed all preceding lessons. See Lesson 1: Creating a database file.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Creating a SQL Anywhere database.

  1. In the left pane of Sybase Central, double-click Tables.

  2. Click the SalesOrderItems table.

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

  4. Start the Create Foreign Key Wizard. Click File » New » Foreign Key.

    1. In the To which table do you want this foreign key to refer list, click the Products table.

    2. In the What do you want to name the new foreign key field, type ProductIDkey.

    3. Click Next.

    4. In the Do you want this foreign key to reference the primary key or a unique constraint field, click Primary key.

    5. In the Foreign Column list, click SalesOrderItemsID.

    6. Click Finish.


You have created a foreign key for the SalesOrderItems table.

You have completed the tutorial on creating a database.


Insert information into your database.

 See also