In this tutorial we create a table in the sample database. The new table will describe different offices for the fictitious company.
Expand the server and database containers, then click the Tables folder to open it.
Click the New Table toolbar button or choose File > New > Table (Alt+F, N, T). This starts the Table Creation wizard.
Type the new table name in the dialog box. In this case, use the name office.
From the dropdown menu, select the owner for the table. By default, the asiqdemo database has only one user, DBA. Click Next.
For this tutorial, click or arrow to the dbspace IQ_SYSTEM_MAIN to store the new table there. (On a query server in a multiplex database, this would not be possible.) Click Next.
Click in the Comment field and type:
Company offices
in the Comment text box. Comments are optional. Click Finish.
The office table appears in the left pane, and the column tab in the right pane. Follow the steps in Creating columns for a table to add columns to the new table.
The Create Table wizard adds each new table to the hierarchy and displays a columns tab for you to complete.
To use the new column as a primary key, leave the PKey box checked.
If a check box appears under Allow Nulls column, or if duplicate values are stored in the office_id column, the column cannot be changed to a primary key.
In the Name box in the first row of columns, type the name of the first column in the table. For this tutorial, use the name office_id.
Select the Data Type integer. Leave the ID, Size, Scale, Nulls, Unique and Comments columns blank for the office_id column.
Tab to a new row or use Alt+F, N for a new column. Add rows for the following columns, following steps 3 and 4 and tabbing to the Size/Precision column to add the sizes below. Leave the Allow Nulls column checked for each:
region char(7)
street char(40)
city char(20)
state char(2)
zip char(9)
Finish creating the table by clicking the Save Table toolbar button . The office table is now visible on the tables tab in the right pane of Sybase Central.
The table is now present in the database, although it has no data. To enter data, use the Interactive SQL utility or the Data tab.
The following section describes how to edit an existing table.