Billybob54
11-29-01, 04:45 AM
how do you set a primary key to a table?
you can make a primary key like this:
create table table_name(
id mediumint(8) NOT NULL AUTO_INCREMENT,
users varchar(15),
primary key (id)
)
id would become the primary key.
To add a primary key to a column that already exists use the ALTER statement:
alter table table_name add primary key(id)
btw, anytime you use auto_increment the column must be not null and primary.
~bud
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.