Jump to content

Basic Question...DB Design...Cant think....


shane85

Recommended Posts

sorry guys its been a long day and this is an extreme newbie question but for whatever reason right now I cant wrap my head around the concept right now...

say for instance one wanted to make a db for job postings, where one could go and see many different categories etc etc. Would you create a table "jobs" and then create rows for the types ie) Accounting, Business, Customer Service, etc. - or would those be all seperate tables as well? Cause im just thinking of the INSERT INTO query, and say I wanted to add a job but I only wanted to add one to the Customer service portion of the jobs table...thats why im curious if everything should be different tables so you could just do INSERT INTO customer_service etc etc and then have all of the persons names/creditials there? OR is it possible to create a table within a table? or am I simply going nuts here? lol. thanks

Link to comment
Share on other sites

Yes, it should all go into different tables.

 

jobs (id, type_id, ..)

jobs_types (id, ..)

 

In jobs_types you add Account, Business, Customer Service as individual rows. To create a job about Customer Service insert it like:

 

INSERT INTO jobs (1, 3, ...) Assuming 3 is the ID of Customer Service.

 

Link to comment
Share on other sites

hmm ok so really I would only need 2 tables??

1 "jobs" and 1 "job_types" where job_types would have say 15 different categories, numbered properly with ids, then like you said I would pick the row of job_type and insert that into jobs? sorry for the basic questions just trying to design the db properly so I dont have to redo it 100x! I also want to make it so people can add job listings...so information that would be stored in "jobs" would be their info, etc etc, and then for the job_type, transfer that from the job_types table? sorry I hope im making sence.

Link to comment
Share on other sites

Two to start, but you will need more as it grows.  User table probably as well.

 

Indeed those 2 tables were just to answer your questions.

 

1 "jobs" and 1 "job_types" where job_types would have say 15 different categories, numbered properly with ids, then like you said I would pick the row of job_type and insert that into jobs

 

Correct.

 

so information that would be stored in "jobs" would be their info, etc etc, and then for the job_type, transfer that from the job_types table? sorry I hope im making sence.

 

Yup. You can create a dropdown from the values in your jobs_types table:

 

<option value="<?php print $row['id']; ?>"><?php print $row['name']; ?></option>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.