Alter table to Add an PRIMARY KEY : Primary Key « Key « SQL / MySQL
SQL / MySQL
Insert Delete Update
SQL / MySQL
Alter table to Add an PRIMARY KEY
ALTER TABLE tblname ADD PRIMARY KEY
Related examples in the same category
Setting a Primary Key 1
Setting a Primary Key 2
Setting a Primary Key 3
Define and use primary key
Another way to enforce uniqueness is to add a UNIQUE index rather than a PRIMARY KEY to a table.
To drop an index that is not a PRIMARY KEY, you must specify the index name.
Adding primary key for not null column
Defining Primary Keys
Use a PRIMARY KEY constraint
If you were creating a primary key on more than one column, you would include both of those column names in th
Two ways to declare primary key when creating the table
Create a table t that contains an id column that's NOT NULL and declared as a primary key by means of a PRIMAR
A primary key on a column can be created by replacing PRIMARY KEY with UNIQUE in the table definition, provide
Add PRIMARY KEY or UNIQUE directly to the end of the column definition.
Create a primary key on the last_name and first_name columns using a PRIMARY KEY clause
Create a multiple-column primary key using UNIQUE, if the columns are declared NOT NULL
Using three column as the primary key
Drop primary key
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.