Add primary key constraint

ALTER TABLE String target_table ADD CONSTRAINT String pk_tablename PRIMARY KEY (column_name);

Description

Adds a primary key constraint to a table.

Arguments

String target_table

The table you want to add a primary key on.

String pk_tablename

The name of the constraint.

String column_name

The name of the column to be a primary key.

Examples

Example 1

This command will create a primary key on the id column

ALTER TABLE users ADD CONSTRAINT pk_users PRIMARY KEY(id);