database design - Saving a list of strings in sql -


in our system have api call returns list of stations. each station among other things has name , corresponding code. example, response looks like:

[    {     name: "new york c",     code: "0001:074"    },    {     name: "oslo c",     code: "0002:078"    },    ... ] 

this list quite big , contains approximately 3500 stations.

what need create widget can configured have max 50 stations choose from. these stations subset of returned above mentioned call. basically, don't need save names, codes enough.

the question how save subset of stations (codes) in db?

i know 1nf , have read how-to-store-a-list-in-a-column-of-a-database-table.

the thing there no need import 3500 stations , put database because have access call widget. still need save configured subset of data.

any appreciated.

your "list" in json format, , can export database (let's assume mysql):

so have table called "stations" example in db, , table have 2 columns: name , code.

to export json data mysql, need export csv first, using: http://www.danmandle.com/blog/json-to-csv-conversion-utility/ or https://github.com/danmandle/json2csv

then export csv file mysql using: :

load data infile 'filepath/your_file.csv' table stations; 

there plenty of ways achieve same result, can example use php that: http://www.kodingmadesimple.com/2014/12/how-to-insert-json-data-into-mysql-php.html

or using etl (like talend, ssis...).


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -