Importing csv

While importing from CSV,, I have the following fields
empid,
empname,
gender
add1
add2
add3
city
state
country
month
year
salary

the employee records can be duplicated since they are paid salary every month.
the following labels needed to be created, EMPLOYEE, EMPLOYEE_ADDRESS, CITY, STATE, COUNTRY, SALARY

EMPLOYEE can be merged using empid. So whenever employee is created the address needed to be created. For Adddress field, add1 cannot be null, but add2, add3 can be null.

So how to create the ADDRESS node, only if the employee Node is created

Try this:

MERGE (e:Employee {empid: line.empid, empname: line.empname})

//case1: add2 and add3 are both NULL..................

FOREACH(ignoreMe IN CASE WHEN line.add2 IS NULL AND line.add3 IS NULL THEN [1] ELSE END |

MERGE (a:Address {add1: line.add1})
MERGE (e)-[EMPLOYEE_ADDRESS}->(a)

)

//case2: add2 and add3 are NOT NULL..................

FOREACH(ignoreMe IN CASE WHEN line.add2 IS NOT NULL AND line.add3 IS NOT NULL THEN [1] ELSE END |

MERGE (a:Address {add1: line.add1, add2: line.add2, add3: line.add3})
MERGE (e)-[EMPLOYEE_ADDRESS}->(a)

)

//case3: add2 IS NOT NULL and add3 IS NULL..................

FOREACH(ignoreMe IN CASE WHEN line.add2 IS NOT NULL AND line.add3 IS NULL THEN [1] ELSE END |

MERGE (a:Address {add1: line.add1, add2: line.add2})
MERGE (e)-[EMPLOYEE_ADDRESS}->(a)

)

//case4: add2 IS NULL and add3 IS NOT NULL..................

FOREACH(ignoreMe IN CASE WHEN line.add2 IS NULL AND line.add3 IS NOT NULL THEN [1] ELSE END |

MERGE (a:Address {add1: line.add1, add3: line.add3})
MERGE (e)-[EMPLOYEE_ADDRESS}->(a)

)