S
Siegfried Heintze
I want to establish a one to many relationship where multiple JobPostings
share a common JobTitle. This is to implement the user interface where the
user can scroll thru a list of job titles, select a job title and find all
the postings with that job title.
The JobTitle relationship will consist of only two columns: an auto
increment integer field and a field called sName that will store the title
as a VARCHAR(255).
Assuming all the job titles are going to be unique and the auto increment
field is also unique:
Question #1:
Which would you make the primary key? The integer "id" field, or the sName
field, or both? Why?
Would you index the other field too (assuming you did not say both)?
If you are creating new jobs, (perhaps you are scraping them from dice or
hot jobs), you conistantly are looking up job titles to see if they exists
and if so, what is their unique integer id whose value is to be stored in
the fkJobTitle field in the JobPosting relationship.
Question #2:
How would you implement the lookup operation that you would use when
creating a new job posting with a (possibly new and unique) job title? Would
you try an SQL "INSERT" and then wait for an error when that job title is
already there? Or would you use an SQL "SELECT" and then, if the result set
was empty use an "INSERT"?
Thanks,
Siegfried
share a common JobTitle. This is to implement the user interface where the
user can scroll thru a list of job titles, select a job title and find all
the postings with that job title.
The JobTitle relationship will consist of only two columns: an auto
increment integer field and a field called sName that will store the title
as a VARCHAR(255).
Assuming all the job titles are going to be unique and the auto increment
field is also unique:
Question #1:
Which would you make the primary key? The integer "id" field, or the sName
field, or both? Why?
Would you index the other field too (assuming you did not say both)?
If you are creating new jobs, (perhaps you are scraping them from dice or
hot jobs), you conistantly are looking up job titles to see if they exists
and if so, what is their unique integer id whose value is to be stored in
the fkJobTitle field in the JobPosting relationship.
Question #2:
How would you implement the lookup operation that you would use when
creating a new job posting with a (possibly new and unique) job title? Would
you try an SQL "INSERT" and then wait for an error when that job title is
already there? Or would you use an SQL "SELECT" and then, if the result set
was empty use an "INSERT"?
Thanks,
Siegfried