Creating a table and adding columns with Sybase Central

In this tutorial, you create an office table in iqdemo that describes different offices for a fictitious company.

StepsCreating an office table

  1. Do one of the following:

    • In Task view, choose a database from the list of Connected Database, then choose Create a table from the Table Design Tasks.

    • In Folder view, right-click the Tables folder, point to New, and choose Table.

  2. Name the new table office, and click Next.

  3. Click IQ_SYSTEM_MAIN as the dbspace you want to use to store the new table, and click Next.

  4. In the Comment field, enter: Company offices.

  5. Click Finish.

    The Table wizard creates the office table, opens the columns tab in the right pane, and prompts you to define the columns. Follow the steps below to add columns to the new office table.

StepsCreating columns for the office table

On the Columns tab, each row represents a single column, and contains all of the attributes for that column.

  1. Use the values in the following table to create the first column. Leave the PKey box checked.

    Pkey

    Name

    Data type

    ¸

    office_id

    integer

    Leave the ID, Size, Scale, Nulls, Unique and Comments attributes blank

  2. To create a new column:

    • Tab to the end of the current row.

    • Click the New Column button on the Toolbar.

    • Click File, point to New, and choose Column.

  3. Use these attributes to create columns for the office table.

    Name

    Data type

    Size

    Nulls

    region

    char

    7

    ¸

    street

    char

    40

    ¸

    city

    char

    20

    ¸

    state

    char

    2

    ¸

    zip

    char

    9

    ¸

  4. To save the column definitions:

    • Click the Save Table button on the Toolbar.

    • Click File, and choose Save.

The office table is now visible on the tables tab in the right pane of Sybase Central. The office table is now part of the iqdemo database. To add data, click the Data tab, right-click, and choose Add Row, or you can use the Interactive SQL utility. The following section describes how to edit an existing table.