I have an excel spread sheet with 18000 records. Each record has the following data:
First Name, Last Name, Address, DOB, Disabled Permit Number, Issue Date, Exp Date.
A disabled permit number is a unique number and last for 3 years. Since data in the spread sheet is not held in a normalized fashion i wish to import it into a database that has two normalised tables: tbl_citizen and tbl_permit. Primary key for tbl_citizen is citizen_id. Primary key for tbl_permit is (permit_num, citizen_id) with citizen_id being FK referencing tbl_citizen. I have imported the entire spreadsheet into a temporary table called tbl_temp. How would you run a select update query to get citizen data from tbl_temp and insert into tbl_citizen and then insert the corresponding permit data into tbl_permit? Also many of the records in tbl_temp have typos e.g.
John, Smith, 101 Test St, 12.12.1954, 123456, 12.12.2001, 12.12.2004
John, Smit, 101 Test St, 12.12.1954, 234567, 11.11.2004, 11.11.2007
As you can see from the above the surname has a typo but it is the same customer and these sort of typos are all over the show i.e they sometimes appear in the address field or DOB field. Sometimes they are not typos at all e.g. if the citizen has moved address after the first permit was issued therefore the address associated with the second permit will be different.
Any help would be appreciated.
Cheers.