Creating a table and adding columns with Sybase Central

In this tutorial we 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, choose Table.

  2. Name the new table office, click Next

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

  4. In the Comment field, type: 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, do one of the following:

    • Tab to the end of the current row.

    • Click the New Column button on the Toolbar.

    • Click File, point to New, choose Column.

  3. Use the attributes in table below 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. Do one of the following to save the column definitions;

    • Click the Save Table button on the Toolbar.

    • Click File, 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.