On 1/4/2013 7:08 AM, Krzysztof wrote:
CSV has one table for example: name | surname | country. I want split
repeated columns to dictionary tables like:

table customers
- name
- surname
- id_country // FK to table countries

I'm looking for one command which before inserting to "customers" will look
to table countries and check if country exists, if not then insert and
return id, else return existing id.

Have your program keep a list of already-inserted countries, complete with their IDs, in memory. Look up against this in-memory structure. There are only about 200 countries in the world.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to