Jump to content

[SOLVED] multiple references in a table?


SirDuke

Recommended Posts

Hi there. This is my 1st post in this (surprisingly good-looking) forum.

 

i am using mySQL for a project

 

i have a database to manage a company and have a table for emploees (name, salary, ...) and a table for jobs (title, cost, ...). Each emploee can work in many jobs and of course each job is done by many emploees. How do i implement this in mySQL??

 

 

I cannot add a field "emploee_id" in the jobs table cause clearly there are more than 1 emploees on the job. How can i make this dynamic? Always have space for more emploees and never unused space?

 

I am sure this a trivial matter cause it is very common, and i would love to learn the solution  ::)

Link to comment
https://forums.phpfreaks.com/topic/66782-solved-multiple-references-in-a-table/
Share on other sites

you will have a crossing table or a normalization something like

 

employee

---empid

---name

--ect....

 

job

--jobid

--jobdesc

--etc..

 

eployeeXjob

--empid

--jobid

 

Select * form employee

left join job on  eployee.empid = job.empid

left join employeeXjob on employeeXjob.empid = employee.empid

etc....

;D

hmm.. interesting answer..

 

unfortunately i have no idea what "left join" does so i'll have to look it up :) (if there is a really good resource somewhere feel free to let me know -apart from the mysql docs)

 

Thanx for  the answer, though i might return tomorrow with more questions :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.