Guys I would really appreciate it if someone could help me with this. I have a problem inserting records into a one to many relationship database. The scenario is as follow, I have a technician table(techid,name,surname) and a skill table(skillid, skillDesc, techid). The skill table has a techID foreign key.
How can i create a sql statement/procedure to insert a technician with multiple skills assigned to the technician?
I think you should have three tables: Technician(techid, name, surname), Skill(skillid, skillDesc), and Ability(skillid, techid). If you only have two tables, each mapping of a skill to a technician would have to include a copy of the skillDesc, which is redundant information. Instead, you want to tables to define the Technician objects and the Skill objects, and a third table to capture the relationships between them.
First execute this query:
then loop over the skills (psuedocode):