Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to generate a SQL Database from a JSON file?

Well I have a database in JSON format, originally generated from an exel file, but I want to modernize my database and export it into a MySQl database. This is the JSON structure:

[
         {
            "NOMBRE": "TEST",
            "ESPECIALIDAD": "TEST",
            "ESPECIALIDAD2": "TEST PEDIATRICA",
            "ESPECIALIDAD3": "",
            "CEL": "2222009374947478474777",
           etc.....
        }, {
            "NOMBRE": "TEST",
            etc.....
        }
]

If this is not possible or difficult, Its a better option to directly export the exel file into MySQL?

like image 323
Karlo A. López Avatar asked Nov 10 '22 12:11

Karlo A. López


1 Answers

With mysql: You will have to convert it to an CSV, use excel to write SQL, or write some import procedure. With MariaDB you could skip this entirely and use the JSON column format: https://mariadb.com/kb/en/mariadb/column_json/

Upgrading MySQL to MariaDB is easy and quick. It gets you a little bit of a performance increase + this nice JSON column format (and a few more).

like image 135
Norbert van Nobelen Avatar answered Nov 14 '22 21:11

Norbert van Nobelen