Hello noel.
Wednesday, December 10, 2003, 5:09:30 PM, you wrote:
nkmdi> If not is there anyway to automatically generate primary keys for
nkmdi> tables in MySQL.
CREATE TABLE ttt (
id int not null auto_increment primary key,
name varchar(100) not null
);
Please note "auto_increment" token in the example above. It tells MySQL
that id is an auto-incrementing primary key for the table. So, to
insert a row you'd just issue the following query:
INSERT INTO ttt (name) VALUES ('some name here');
INSERT INTO ttt (name) VALUES ('another name here');
or
INSERT INTO ttt (id, name) VALUES (NULL, 'some name here');
INSERT INTO ttt (id, name) VALUES (NULL 'another name here');
Anyway, you'll get the following two records after that:
1, 'some name here'
2, 'another name here'
I hope that helps.
--
See you,
Andrey.
[ subbotin@stripped | ICQ# 114087545 | 2:5090/114@stripped ]
...Perfect guest: One who makes his host feel at home.
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]