The DB will keep track of the primary key which is an integer and will auto increment it so that every "name" will have a unique id number.$dbh->do ("CREATE TABLE bookplateleaf (id integer PRIMARY KEY AUTOINCREMENT, name varchar(20), ) "); my $insert_name = prepare ("INSERT into bookplateleaf name = ?"); $insert_name->execute("someNaME");
Does that help?
Update: I not quite sure what this "box" this is. I could be that just one table will be all that you need.
For some DB's, like SQLite, the varchar(X), the X is just a "hint" and the actual data can be much larger. It is ok for name to appear more than once because it is not the primary key. There is another step to index the database according to more than the primary key - so perhaps that you can search for "name" efficiently.$dbh->do ("CREATE TABLE bookplateleaf (id integer PRIMARY KEY AUTOINCREMENT, name varchar(20), box varchar(8192), ) "); my $insert_row = prepare ("INSERT into bookplateleaf name = ?, box = ? "); $insert_row->execute($name,$box);
I don't think that you are "stupid"..on the contrary for 30 days you have gotten quite far along!
In reply to Re^3: Concatenation of scaler reference
by Marshall
in thread Concatenation of scaler reference
by Largins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |