At 17:42 -0500 7/6/03, Greg Donald wrote:
> my coulmn (id) is an auto_increment coulmn and lets say that i have 100
 entries, so the problem is that when i delete all entries on my table, the
 column (id) starts from 101 ,shouldn't is starts from 1 again!
 please i need help with this

Use truncate table, it will reset the auto_incement.

Always? :-)


DROP TABLE IF EXISTS t;
CREATE TABLE t (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY) TYPE = INNODB;
INSERT INTO t SET i = NULL;
INSERT INTO t SET i = NULL;
INSERT INTO t SET i = NULL;
SELECT * FROM t;
TRUNCATE TABLE t;
INSERT INTO t SET i = NULL;
SELECT * FROM t;

Here's what I get:

+---+
| i |
+---+
| 1 |
| 2 |
| 3 |
+---+
+---+
| i |
+---+
| 4 |
+---+


--
Greg Donald
http://destiney.com/




-- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to