Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

MySQL - primary key vs. add unique index

Avatar of monkeybiz12345
monkeybiz12345 asked on
DatabasesMySQL Server
6 Comments1 Solution2741 ViewsLast Modified:
Greetings Experts!

Greetings!

I'm migrating data from an existing proprietary database (accounting software) to MySQL. To do this, I linked the tables from the accounting software to MS Access using an ODBC driver, then exported each one to a table in my MySQL database via ODBC.  This works great except that the existing indexes don't come over to MySQL.  I added the indexes in MySQL using the following:

ALTER TABLE ap_invoice_detail ADD UNIQUE (supplier, invoice, entry_num, record_type_10);

So far, so good... but I won't be on the planet long enough to finish this task.

Enter Navicat... thanks to a recommendation from this site, I found Navicat which will allow me to set up the import of multiple tables to run unattended.  Yay!

However, importing the data using Navicat creates different results from the above method and this brings up a question for me about use of primary key vs. unique index.

- What is the difference between using a primary key vs. using a unique index as above?  

- Anyone have any thoughts about when to use which, if one is "better" than the other?  

I decided on a unique index because I wanted to use it to prevent duplicates when I merge 2 versions of this data, but it looks like Navicat has a built-in way to handle that in the import wizard.

Many thanks for your help with this!


ASKER CERTIFIED SOLUTION
Avatar of PranjalShah
PranjalShahFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers