Inserting filtered data from one table to another I need to find the number of employees who are not in all departments.

I have one more table T2 in which same department column is present. Now I want to insert only those values of department which are not in T1.Department for those employees whose name doesn't appear in all 37 departments.

I'm using MySQL.

Do I need to make any procedure for this?

Reference to : Need to find the number of employee who are not in all department 

Tables

create table T1 (empname, department)
create table T2 (department)
You can insert the result of a SELECT using INSERT ... SELECT syntax. To get rows from one table that do not have corresponding rows in another you can use the A not in B LEFT JOIN MySQL idiom or a similar one with NOT EXIST subquery (though the latter is less efficient).

Please give your table details for more specific query.