V
V
Vladimir Golub2015-03-24 05:32:56
MySQL
Vladimir Golub, 2015-03-24 05:32:56

Pushing data from .xml file into MySQL?

The problem is the following. There is a database in it two tables clients and orders. I take information about orders from xml files. How to get rid of duplication of data in tables orders. For example, a column: statuses. In order not to write the same status every time. For example, let's create a status table.
When parsing with a script, I need to somehow check whether there is already such a status. If not, then add it to the status table. And if there is, then take the code of this status. Wouldn't it be long.
Or to increase the speed to leave everything as it is?
Yes, and there will be about 5-6 such columns.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valery Ryaboshapko, 2015-03-24
@RazerVG

Given that you will search by status very often, it makes sense to put them in a separate table so that the search in the main table is an integer.
Yes, the search for duplicates will take a little extra time, but if there is an index, the hitch will not be noticeable.

I
Immortal_pony, 2015-03-24
@Immortal_pony

Mysql knows how to work with xml .
To control the behavior in case of duplicates, specify the REPLACE or IGNORE keyword (you can read more about them here )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question