Advice on Database Design

Posted on 2013-05-25
Last Modified: 2013-06-02
Hi Experts,

I am planning to develop a small careers web site with the following 2 pages in and need advice on DB design.

1)Display Jobs Page

Regions(Dropdown):  Showing All Regions (USA,UK,AUSTRALIA ETC)

States(Dropdown): Displaying STATES Corresponding to Region.

Locations(Dropdown):Displaying cities based on State.

A Grid displaying all jobs with below fields

Job Title         Date            Work Type            Location/City                Salary

2)Post Jobs Page

Job Type (Dropdown):To display all Job Types

Job Title (Dropdown):To display all Job Roles

Description: Desc of the Job



Location/City (Dropdown):


For the above task I am considering following Tables and fields in my database and need advice on database design and relationships on the tables.

1)Regions- RegionId,RegionName





Ex:Lansing,Las Vegas Etc

4)Job Type: JobTypeId,Job TItle

Ex: Perm,contract,Casual

5)Roles: RoleID,RoleName

Ex:Project Manager,Team Lead etc.

1)I have Salary column and not sure this should have a separate table or Do I need to include Salary column in any of the above tables?

2)Do I need more tables apart from above 5 tables to acheive my task? If yes, let me know the table(s) with field names.

And also let me know if additional fields are required for the above 5 tables.

3)How to idenfiy Primary key's, Foreign keys and relationships on these tables.

4)For this simple database with just having 5 or 6 tables, Do I need Normalization?

I  do understand DB design is a heavy subject and your inputs would be highly appreciateted
Question by:ksd123
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
LVL 15

Expert Comment

ID: 39196842
As far as salaty goes, you can do it several ways. Firstly have a string so that you have complete control over what goes in there. You could also have a table that has salary ranges.

You will need a main database that links all of the information for an individual position. This can then either have the salary field as a string, or as an index to the salary table.


Table AvailableJobs
JobID as integer
Region as integer
State as integer
Location as integer
JobType as integer
Role as integer
Salary as Integer or String

This design is using normalization, the ID fields of the individuakl tables should be the primary key for thiose tables
LVL 35

Expert Comment

by:David Todd
ID: 39197409

Consider using the state abbreviation as the key - which means for most queries one less table to join to for the select. Its not as if the abbreviation or natural key is going to get changed.

Think about having a free text salary field, but link to a salary table which has bands every 10k or so - easier for searching.


Author Comment

ID: 39198861

Thanks for your comments.But I need  briefly explaination for the following questions that would really help me to understand basic db design concepts.

1)How to handle salary data?plz suggest me the best way with table structure?

2)In all the 5 tables , which columns fit for Foreign Key  and also  Relationships between the tables?(one-many/many-one etc).

3)Since we just had 2 columns in all the tables do I still need to do normalization?


1)Regions:-RegionId (PK), Region Name

2)States:-StateId (PK), State Name  

3)Locations:-LocationId(PK), Location Name

4)Jobs :-JobTypeId(PK), Job TItle

5)Roles:-RoleID(PK), Role Name
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

LVL 15

Assisted Solution

ChloesDad earned 50 total points
ID: 39198873
Normalisation is a yes, as it means that you only store an integer in the main table rather than having a full string each time.

With the salary, it depends on what you want to save. As most jobs will offer a salary range then you could use two numbers SalaryMin and Salary Max. You can then use a dropdown on the search page with salary ranges .

The references to the ID fields in the lookup tables will all be foreign keys as they reference a primary key in another table. For this reason, the relationship between the two tables is called a one to many relationship between the referenced table and the referencing table. (i.e. one record in the lookup table is referenced many times in the main table)
LVL 69

Accepted Solution

Scott Pletcher earned 350 total points
ID: 39201989
Spend some time on this design!  Proper db design, including normalization, are absolutely necessary to end up with a good app.

See initial, quick sample table designs below for some ideas.  "Subregion" seems a little awkward, maybe you can think of a better generic term.

[Btw, never use a string to hold salary and/or salary range or any other genuinely numeric data.  Instead, use separate string columns or codes as appropriate to further define the salary.]

    Subregion_Name /* 'State'(USA)|'State/Territory'(Australia)|'??'(UK/GB) */

    SubregionId /* 'CA'|'FL'|'??'|... */
    RegionId; FK /* 'USA'|'Aus';... */
    Name /* 'California'|'Florida'|'Queensland'(?)|... */

    SubregionId; FK

    [Type] /* 'Casual'(?)|'Contract'|'Permanent'|... */

    Category /* 'Full-time'|'Part-time'|...*/

    Shift /* '8AM-5PM'|'Night shift'|'Swing shift'|...*/

    Level /* 'Executive'|'Managerial'|'Team Lead'|'Vice President'|... */
    Classification /* 'Hourly'|'Salaried'|... */
    SalaryTimePeriod /* 'Hourly'|'Per piece produced'|'Yearly'|... */
    MinSalary decimal(9, 2)
    MaxSalary decimal(9, 2)

    JobTypeId; FK
    JobCategoryId; FK
    JobShiftId; FK
    JobLevelId; FK
    JobSalaryId; FK
    LocationId; FK
    Description /* 'Manager of ...'|'Team lead for...'|'Will assist...'|... */

Author Comment

ID: 39203225
Hi ScottPletcher,

Thank you so much for your valuable inputs and now got some basic understanding of DB design.Based on my requirement will create some Stored procs,Views,Functions on these tables.

But I have little confusion on how to maintain Audit/Log  details in genearal and in my case on which table do I need create trigger ?

The other question I have is ,by default cluster index will create on PK and in my case when should  I go for non-clustered index?

Thanks in Advance
LVL 69

Assisted Solution

by:Scott Pletcher
Scott Pletcher earned 350 total points
ID: 39204814
Again, do NOT rush into creating procs, functions, etc., first spend some time on just the db design.  That small investment in time will pay off huge later.

I'm not sure what or why you need to audit/log data.  If you have Enterprise edition, you can use CDC.  Otherwise, yes, you may have to use triggers.

As to clustering, you should cluster on a column you will often sort and/or group on.  You'll need to further review your requirements.  At first, you can just make your best guess on which should be the clus index, make the rest nonclus, then after the system is running for a while look at missing index stats (sys.dm_db_missing_index_* views) and index usage stats (sys.dm_db_index_usage_stats).  Unless you have millions of rows at the start, you can get away with a best guess and adjust it later.

Author Closing Comment

ID: 39214195
Thanks ScottPletcher

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Get Store Procedure Column Name As Row 5 41
SQL Distinct Question 3 15
SQL Server XML Select sub tables 4 33
Need to find substring in SQL 3 15
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question