How to transform a column to the primary key?

  • Follow


Hi,

I have a table with a column of the following type: bigint(20)
unsigned. The name of the column is "id". The table has 20 rows and
for every row the value in the "id" is unique. Is that possible to
make my "id" column to be "primary key". And, if yes, how?

Thank you in advance.
0
Reply kurdayon (125) 10/2/2008 2:49:11 AM

On Oct 1, 10:49 pm, Kurda Yon <kurda...@yahoo.com> wrote:
> Hi,
>
> I have a table with a column of the following type: bigint(20)
> unsigned. The name of the column is "id". The table has 20 rows and
> for every row the value in the "id" is unique. Is that possible to
> make my "id" column to be "primary key". And, if yes, how?
>
> Thank you in advance.

For an existing table, you could use
ALTER TABLE t ADD PRIMARY KEY (col);
0
Reply toby23 (1080) 10/2/2008 3:53:35 AM


Kurda Yon wrote:
> Hi,
> 
> I have a table with a column of the following type: bigint(20)
> unsigned. The name of the column is "id". The table has 20 rows and
> for every row the value in the "id" is unique. Is that possible to
> make my "id" column to be "primary key". And, if yes, how?
> 
> Thank you in advance.
> 

http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

0
Reply jstucklex (14363) 10/2/2008 3:57:54 AM

2 Replies
31 Views

(page loaded in 0.218 seconds)


Reply: