List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 19 2000 10:29pm
Subject:Re: AUTO_INCREMENT & transform the database to the server?
View as plain text  
At 2:01 PM -0800 12/18/00, Qian Chen wrote:
>I have a couple of questions on MySQL:
>
>
>
>============================================================================
>===============================
>1. about  "AUTO_INCREMENT"
>
>I have a database "db".  In db, I created the first table "table1", using
>AutoNumber as primary key. 
>
>create table table1 (
>id1		INT	NOT NULL	AUTO_INCREMENT	PRIMARYY KEY,
>text_a	TEXT	NOT NULL,
>text_b	TEXT  NOT NULL
>);
>
>insert into  links values
>(LAST_INSERT_ID(), 'text_a', 'text_b'), (NULL, 'text_a', 'text_b');

Why are you using LAST_INSERT_ID() here?


>So I have a table has two records, with primary key as 1 & 2.
>Then I created a second table "table2", also I want to use AutoNumber as
>primary key.
>
>
>create table table2 (
>id2		INT	NOT NULL		AUTO_INCREMENT	PRIMARYY
>KEY,
>text_m	TEXT	NOT NULL,
>text_n	TEXT NOT NULL
>);
>
>insert into announcement values
>(LAST_INSERT_ID(), 'text_m', 'text_n'), (NULL, 'text_m', 'text_n');


Why are you using LAST_INSERT_ID() here?


>
>It turns out that in table2, the primary key begins with 3, and then 4, ...
>so on.
>
>
>?-------My question is:  How can I begin an auto number begins with '1' for
>table2?
>
>
>
>============================================================================
>==================
>
>2.  I created database "db" locally on my machine, how can I transform the
>database to the server?

Sounds like you may want to use mysqldump.

-- 
Paul DuBois, paul@stripped
Thread
AUTO_INCREMENT & transform the database to the server?Qian Chen18 Dec
  • Re: AUTO_INCREMENT & transform the database to the server?Paul DuBois19 Dec