Need help with database structure. Really Need Help!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
urb
Forum Newbie
Posts: 21
Joined: Fri Nov 08, 2002 1:08 am
Location: Los Angeles, California

Need help with database structure. Really Need Help!

Post by urb »

I was wondering how to set a database table to where when i add a product to the table, the primary key named "id" with start at 0001 and auto increment up to 9999 at the max. So really I would like to know is how to get the "id" to start incrementing at 0001 if at all possible?


Thanks for your time

Matt Urban

aka -=urb=-
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

dusty
Forum Contributor
Posts: 122
Joined: Sun Apr 28, 2002 9:52 pm
Location: Portsmouth, VA

Post by dusty »

ZEROFILL is what you need
User avatar
puckeye
Forum Contributor
Posts: 105
Joined: Fri Dec 06, 2002 7:26 pm
Location: Joliette, QC, CA
Contact:

Post by puckeye »

And you configure your column to be smallint with 4 numbers. You'll have to take care of not going to 10000 because the records simply won't be saved in the DB.

I don't know how to reset the auto-increment to 0001 again though.

Puckeye
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

ALTER TABLE orders AUTO_INCREMENT = 0001;
Post Reply