Question about autoincrement ID

2006-03-23 Thread saf
Hi, I have a question about autoincremend id: If I have an autoincrement id set on my first column field of my table and I have the following entries: 1 3 And then I make a INSERT INTO foobar VALUES(''); , the next field would be automatically 4: 1 3 4 Is there a possibility to take a free ID

Re: Question about autoincrement ID

2006-03-23 Thread SGreen
[EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: Hi, I have a question about autoincremend id: If I have an autoincrement id set on my first column field of my table and I have the following entries: 1 3 And then I make a INSERT INTO foobar VALUES(''); , the next field

Re: Question about autoincrement ID

2006-03-23 Thread saf
On Thu, Mar 23, 2006 at 11:04:55AM -0500, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: The short answer is no. The Record #2 already existed. It's current status is deleted. If you had other tables that linked their data to record #2 and you created a

Re: Question about autoincrement ID

2006-03-23 Thread Alec . Cawley
[EMAIL PROTECTED] (saf) wrote on 23/03/2006 16:10:04: On Thu, Mar 23, 2006 at 11:04:55AM -0500, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: The short answer is no. The Record #2 already existed. It's current status is deleted. If you had other

Re: Question about autoincrement ID

2006-03-23 Thread saf
On Thu, Mar 23, 2006 at 04:17:44PM +, [EMAIL PROTECTED] wrote: Lots of ways round this. Instead of deleting records, add a boolean deleted flag. All selects then need to add and deleted = 0. But you can find a (random) deleted row with select id from table where deleted = 1 limit 1. If

Re: Question about autoincrement ID

2006-03-23 Thread Martijn Tonies
So I must do a big SELECT and then check my self every time (for each INSERT), which IDs are free? No, you just ignore deleted IDs. What's the point? Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts:

Re: Question about autoincrement ID

2006-03-23 Thread SGreen
[EMAIL PROTECTED] (saf) wrote on 03/23/2006 11:10:04 AM: On Thu, Mar 23, 2006 at 11:04:55AM -0500, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (saf) wrote on 03/23/2006 10:50:10 AM: The short answer is no. The Record #2 already existed. It's current status is deleted. If you had other

Re: Question about autoincrement ID

2006-03-23 Thread mysql
On Thu, 23 Mar 2006 [EMAIL PROTECTED] wrote: To: saf [EMAIL PROTECTED] From: [EMAIL PROTECTED] Subject: Re: Question about autoincrement ID One important thing to remember: You should not let UI design requirements dictate your DB design. Most developers who design the database just