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 2: Connect to the database Next Page

Lesson 3: Create a table

In this lesson, you create a table named Products.

For information about designing tables, see Designing the database table properties.

To create a table
  1. In the right pane of Sybase Central, double-click the Tables folder.

  2. From the File menu, choose New > Table.

    The Create Table wizard appears.

  3. Name your table Products.

  4. Click Finish.

    The database server creates the table using defaults, and then displays the Columns tab in the right pane. Each row in the Column tab defines a column in the table.

  5. Define the first column in your table, and make it the primary key.

    A primary key can comprise several columns concatenated together. For the purposes of this tutorial, however, the primary key contains only one column, which has a value that is automatically incremented for each row added to the table. The autoincrement property ensures that values are unique—a requirement for primary keys. See, Primary keys.

    1. PKey    Place a checkmark in the PKey column to specify that the column is used as part of the primary key for the table.

    2. Name    Give the column a name of ProductID.

    3. Data Type    Specify the data type as follows:

      • Give the column the integer data type.

        An ellipsis displays in the right half of the Data Type column.

      • Select the ellipsis to access the property sheet for the column.

      • On the Value tab, select Default Value.

      • Select System-defined, and then choose autoincrement from the dropdown list.

    4. Click OK to close the Column property sheet.

  6. Create an additional column.

    From the File menu, choose New > Column, and add a column with the following properties:

  7. From the File menu, choose Save.