r/DatabaseHelp • • Sep 27 '18

Converting flat table into relational model

I own a small insurance business and an importing my data into a CRM. The CRM Company told me they would import all of my data for me, but despite the fact that i told them the format my data was in they are now insisting it has to be in a specific format, which it is not. Now they are trying to charge me a ridiculous fee to import it that i am refusing to pay them on principle of they misinformed me.

Good news is I used to work with MySQL a lot as i got of got shoe-horned into a quasi-dba position in my old career where i was a linux admin. So i'm familiar with mysql somewhat, however it's been a couple of years and i'm feeling a bit out of my comfort zone and looking for some guidance.

Currently I have a CSV file with all of my client data, 1 row per policy, each policy covers a single individual (no group policies), however, i may have multiple policies per individual, or per household.

For the CRM i need to normalize this data in order to input it. Into tables for Account, Contact, Carrier, Carrier Product, Policy. And return it to them as a CSV.

I have no idea how to convert this flat file into a relational model, and that's what i'm asking for help with. If i have to pay a small fee for a software package to assist i'm not against it. If it's just a bunch of steps in sql i'm not opposed to that either, but i'm looking to get this done as quickly and painlessly as possible.

Here is a simplified example of what i have and what i need:

Currently I have an excel spreadsheet similar to this:

FNameLnameAddressCarrierCarrierProductEffectiveDate
JohnSmith123 California AveAnthemPlusPlan09/01/2018
MariaSmith123 California AveAnthemElitePlan08/01/2015
RichardJohnson84 New Jersey WayAetnaPPOSelect01/01/2010
JohnSmith123 Calofirnia AveStateFarmTermLife02/01/2016

I need to turn this into a relational model that looks something like this:

Carrier Table:

carrier idcarrier
1anthem
2aetna
3StateFarm

Carrier Product Table:

Carrier product idproduct namecarrierReference
1PlusPlan1
2ElitePlan1
3PPOSelect2
4TermLife3

Contact:

ContactIDAccountIDRefFNameLNameAddress
11JohnSmith123 California Ave
21MariaSmith123 California Ave
32RichardJohnson85 New Jersey Way

Account:

AccountIDAccountNamePrimaryContactIDRef
1John & Maria Smith Household1
2Richard Johnson Household3

Policy:

PolicyIDAccountIDRefContactIDRefCarrierIDRefCarrierProductIDRefEffective Date
1111109/01/2018
2121208/01/2015
3232301/01/2010
4113402/01/2016
3 Upvotes

4 comments sorted by