views:

660

answers:

6

For a school project I'm making a simple Job Listing website in ASP.NET MVC (we got to choose the framework).

I've thought about it awhile and this is my initial schema:

JobPostings
+---JobPostingID
+---UserID
+---Company
+---JobTitle
+---JobTypeID
+---JobLocationID
+---Description
+---HowToApply
+---CompanyURL
+---LogoURL

JobLocations
+---JobLocationID
+---City
+---State
+---Zip

JobTypes
+---JobTypeID
+---JobTypeName

Note: the UserID will be linked to a Member table generated by a MembershipProvider.

Now, I am extremely new to relational databases and SQL so go lightly on me.

What about naming? Should it be just "Description" under the JobPostings table, or should it be "JobDescription" (same with other columns in that main table). Should it be "JobPostingID" or just "ID"?

General tips are appreciated as well.

Edit: The JobTypes are fixed for our project, there will be 15 job categories. I've made this a community wiki to encourage people to post.

+1  A: 

A few thoughts:

  • Unless you know a priori that there is a limited list of job types, don't split that into a separate table;
  • Just use "ID" as the primary key on each table (we already know it's a JobLocationID, because it's in the JobLocations table...);
  • I'd drop the 'Job' prefix from the fields in JobPostings, as it's a bit redundant.

There's a load of domain-specific info that you could include, like salary ranges, and applicant details, but I don't know how far you're supposed to be going with this.

womble
There will be a fixed number of job types. About 15 of them if I remember. This will be a job listing site for a niche industry and the categories are limited and fixed.
Simucal
@Simucal: Well, that answers that question. I just see a lot of people go overboard with the normalisation and then have to spend a lot of time managing ever-changing lists of things that really shouldn't be fixed lists.
womble
Yes its JobPostingID in the JobPostings table, and ID would be obvious, but my opinion is that when you start doing joins JobPostings.JobTypeID = JobTypes.ID is more human-error prone to comparing inappropriate columns than JobPostings.JobTypeID = JobTypes.JobTypeID
Kristen
Naming convention discussion gets religious fast though ...
Kristen
+1  A: 

Looks good to me, I would recommend also adding Created, LastModified and Deleted columns to the user updateable tables as well for future proofing.

Make sure you explicitly define your primary and foreign keys as well in your schema.

Craig Bovis
adding the Created, LastModified, and Deleted columns seems unnecessary to me. YAGNI. Also, it's just a school project.
Steven Oxley
I've never seen those columns in a school project. More than 90% of the tables in our databases have them. Hmmm ...
Kristen
The created column is a good idea. We'll need it to display how many days their listing has left.
Simucal
A: 

What about naming? Should it be just "Description" under the JobPostings table, or should it be JobDescription (same with other columns in that main table). Should it be "JobPostingID" or just "ID"?

Personally, I specify generic-sounding fields like "ID" and "Description" with prefixes as you suggest. It avoids confusion about what the id/description applies to when you write queries later on (and saves you the trouble of aliasing them).

What about CompanyName, would it be JobCompanyName? or just CompanyName? I hate naming things and trying to be consistant.
Simucal
A: 

I'd recommend folding the data you're going to be storing in JobLocations back into the main table. It's ok to have a table for states and another for countries, but I doubt you want a table that contains every city/state/country pair, you really don't gain anything from it. What happens if someone goes in and edits their location? You'd have to check to make sure no other joblisting points to the location and edit it, else create a new location and point to that instead.

My usual pattern is address and city as text with the record and FK to a state table.

Parrots
+1  A: 
FlySwat
Thanks Jonathan, this provides what I wanted to know.
Simucal
A: 

How would you include say a list of skills to your jobs table?

justnotnormal