QUOTE (signatureimage @ May 23 2005, 01:35 AM)
Dear jedipi,
While deciding on the columns (=fields) of your data-base table,
you should definitively use an extra column that has the
data-base attribute
autoincrement .
This extra column will be used by the data-base engine as a counter,
and the value of this column will be created by the data-base engine,
everytime that a new row is inserted into the data-base table.
Its value will
auto-increment - as the name suggests.
Most data-base designers use the name
id for this extra column.
If you want to obtain the last inserted row of the data-base table,
all you have to to is request the row that has the highest value in that column.
You ask the highest value with the
MAX() data-base function, as in
SQL
SELECT MAX(id) FROM myuserid_mydatabasetable;
Thanks signatureimage,
yea, autoincrement is a good way to do that...
I have used this method for the new tables in the database.
However, the system I am developping is going to be integrated with the old system. There are some tables in the database already.
Can i add extra autoincrement column to the old table without affecting the old system???
Comment/Reply (w/o sign-up)