ALTER TABLE DROP
PRIMARY KEY
Drops the
primary key from a table.
SYNTAX

| table_name |
Name
of the table you are dropping the primary key from. |
DESCRIPTION
The ALTER
TABLE DROP PRIMARY KEY command modifies the definition of an existing
table and drops the primary key that was previously defined. To execute
the ALTER TABLE DROP PRIMARY KEY command on a table, you must be the table
owner, have DBA security privilege, or have both the ALTER and INDEX privileges
for that table.
A key is
a column or combination of columns that help identify specific rows in
a table. The columns that make up a key are known as key columns. A unique
key is a key in which no two records have the same value for the key field.
A primary
key is a key that uniquely identifies each row in a table. Without a primary
key, it is impossible to distinguish between specific rows in a table
because rows may contain duplicate values. The DBMS will not allow you
to define a primary key on columns that contain duplicate values, and
will not allow you to enter a duplicate value in a primary key that already
exists.
A foreign
key is a key that corresponds to the primary key (or a unique index) of
another table. This establishes a parent-child relationship between two
tables that is represented by common data values stored in the tables.
The parent table contains the primary key or unique index, and the child
table contains the foreign key whose columns correspond to columns in
the parent table.
Referential
integrity ensures that every value in a child key (the foreign key of
the child table) has a corresponding value in the parent key (the primary
key or unique index of the parent table). Referential integrity is enforced
between tables using the parent-child relationship established with foreign
keys. DBMaker has automatic support for referential integrity constraints
between tables through the definition of foreign keys. When adding a record
to a child table, the value in the child key must also exist in the parent
key. Similarly, when deleting a record from the parent table, all records
in the child key with the same value must be deleted first.
You can
use this command to drop the primary key on a table when it is no longer
necessary. Since DBMaker enforces referential integrity when a foreign
key is defined, you must drop all foreign keys that refer to a primary
key before you drop the primary key. After you drop a primary key, DBMaker
no longer requires a unique key value for each record; it will be possible
to enter values that may make two records indistinguishable from each
other, possibly causing inconsistency in your database. This command should
be used with caution.
EXAMPLE
The following
command drops the primary key from the Employees table.
ALTER TABLE Employees DROP PRIMARY KEY
|
RELATED COMMANDS
<
ALTER TABLE DROP FOREIGN KEY | Contents
| ALTER TABLE FOREIGN KEY >
|