Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Default Value in a field

Status
Not open for further replies.

Tread42

MIS
Feb 5, 2002
151
US
I'm a fresh water newbie, just learing how to swim. I wondered if you could possibly help me?

I have a field that I would like to set a default value in. For example. I want this field 'ID' to start with 100 instead of 0 and auto increment.

Any idea on how to establish this in PHP MyAdmin?

Regards,
Tread42
 
I see the autoincrement field. I guess what I'm asking is how do I make it start at 100 instead of 0? Or say I want the field named registration to be fall101, then fall102 and so on. Is it possible to mix auto incrementin numbers with text?

If not I can stick to just the numbers but the client isn't wanting to start at 0.

Regards,
Tread42
 
make it start at 100 by setting it in the CREATE TABLE statement
Code:
create table myfoo
( id integer not null primary key auto_increment
, foo varchar(9)
) auto_increment = 100;

no you cannot mix it with text, but you can always select it that way:

Code:
select concat('fall',id) as semester , ...;

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top