Re: MySQL: Add Autoincrement Field?
| From: | Brian Drexler | Date: | Sat, 17 Feb 2001 04:39:34 +0000 |
| Subject: | Re: MySQL: Add Autoincrement Field? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40293@lists.php.net to get a copy of this message | ||
alter table $TableName add column $ColumnName NOT NULL AUTO_INCREMENT
PRIMARY KEY;
Have a nice day!
Brian Drexler
Precision Web Design
----- Original Message -----
From: Jeff Oien <jeff@webdesigns1.com>
To: PHP <php-general@lists.php.net>
Sent: Friday, February 16, 2001 11:30 PM
Subject: RE: [PHP] MySQL: Add Autoincrement Field?
> Could you tell me how to add a field to an existing
> database? I'm having trouble finding out how to do it.
> Thanks.
> Jeff Oien
>
> > just add a field unique_id int auto_increment in the table...u dont have
to
> > do anything more...it will start at 1 and every time a new record is
added
> > to the table this value will be incremented....
> >
> > > I have an existing database from a flat file that I
> > > imported into a MySQL table. Some of the title
> > > fields are duplicates - songs with the same name
> > > from different song books. So if I want to delete
> > > a record by title, I'll end up deleting all songs with
> > > that title. Is there a way I can add a unique id field
> > > and have it automatically generate a unique number to
> > > each record? Hope that made sense.
> > > Jeff Oien
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> > >
> > >
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net