Creating Primary And Foreign Keys - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Creating primary and foreign keys

Creating a primary
key
Creating a primary
key in Sybase Central
The
and
CREATE TABLE
tables to be set, including column constraints and checks. This section shows
how to set table attributes using the primary and foreign keys as an example.
The following statement creates the same
primary key is added:
CREATE TABLE skill (
skill_id INTEGER NOT NULL,
skill_name CHAR( 20 ) NOT NULL,
skill_type CHAR( 20 ) NOT NULL,
primary key( skill_id )
)
The primary key values must be unique for each row in the table which, in this
case, means that you cannot have more than one row with a given
row in a table is uniquely identified by its primary key.
Columns in the primary key are not allowed to contain NULL. You must
specify
on the column in the primary key.
NOT NULL
Note
Adaptive Server IQ does not enforce multi-column primary keys. You
must specify the keyword
primary key.
To create a primary key in Sybase Central:
1
Connect to the database.
2
Click the Tables folder for that database.
3
Right-click the table you wish to modify, and select Properties from the
pop-up menu to display its property sheet.
4
Click the Columns tab, select the column name, and either click Add to
Key or Remove from Key.
CHAPTER 3
Working with Database Objects
statements allow many attributes of
ALTER TABLE
table as before, except that a
skill
when you define a multi-column
UNENFORCED
. Each
skill_id
125

Advertisement

Table of Contents
loading

Table of Contents