I have a database dump given in json format. I need to write the database schema for it.How we can generate relational database schema from json file? The text fields are straightforward; but I am not sure about fields taking multiple values. Example of my son format is as follows.

    "name" : "Ali A",
    "year" : 2000,
    "Id_number" : 15246,
    "fields" : {
            "Doctor Name": "Ayla X",
            "Hospital_names" : ["City Hospital", "Central Park", "Eastern Star"],
            "Nurse" :  [null, "Ayel"]
            "procedure_ids" : [12, 15, [457, 454]]
    }} ,
    {"name" : "Veli A",
    "year" : 2013,
    "Id_number" : 17446,
    "fields" : {
            "Doctor Name": "Ayla X",
            "Hospital_names" : ["City Hospital", "Central Park", "Eastern Star"],
            "Nurse" :  [null, "Derya"]
            "procedure_ids" : [2, 46, [4, 78, 78]]
  • You're looking at "relationships" in the data (eg. Patient Ali A has - presumably - visited City Hospital, Central Park and Eastern Star). The different entities that make up the relationships (in this particular case "Patient" and "Hospital") will first require their own, individual tables (to hold their corresponding information), and then you will have additional tables (eg. "PatientHospital") to establish the relationships between those entities. I guess one question that might arise is - do the "Procedure IDs" corresponding - in sequence - to the hospitals that the patient attended?
    – Craig
    Apr 4 at 1:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.