Jump to content

Create a unique key column after the database has been populated


poleposters

Recommended Posts

I suspect you could but I don't know for sure.

 

What you can do to test though, is to create a duplicate table with a different name.  You can do something like "CREATE TABLE mytesttable LIKE myexisting table;" refer to the MySQL documentation for details.

 

Then you can do "INSERT INTO mytesttable SELECT * FROM myexistingtable WHERE 1=1;"  Again, see the MySQL documentation for particulars.

 

Now that your test table is populated, you can mess around with it any way you want to.  Add new columns and see what happens.

 

When you're done, eliminate the test table: DROP TABLE mytesttable;

Link to comment
Share on other sites

yes...

 

Do this

 

1. Choose table (Structure view, second tab)

2. Find: "Add ... field(s)"

3. Check the radio that says "At beginning of table"

4. Click "GO"

 

5. Give the field a name

6. Change the type to smallint, int, bigint, etc...

7. Check the first radio button "Primary"

8. Change Extra to "AUTO_INCREMENT"

9. Press "Save"

 

That should add the column to the beginning of the table with the increments starting at 1 and incrementing by one for each field.

 

Hope this helps!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.