shane85 Posted October 25, 2010 Share Posted October 25, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/216752-basic-questiondb-designcant-think/ Share on other sites More sharing options...
ignace Posted October 25, 2010 Share Posted October 25, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/216752-basic-questiondb-designcant-think/#findComment-1126078 Share on other sites More sharing options...
shane85 Posted October 25, 2010 Author Share Posted October 25, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/216752-basic-questiondb-designcant-think/#findComment-1126080 Share on other sites More sharing options...
revraz Posted October 25, 2010 Share Posted October 25, 2010 Two to start, but you will need more as it grows. User table probably as well. Quote Link to comment https://forums.phpfreaks.com/topic/216752-basic-questiondb-designcant-think/#findComment-1126083 Share on other sites More sharing options...
ignace Posted October 25, 2010 Share Posted October 25, 2010 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> Quote Link to comment https://forums.phpfreaks.com/topic/216752-basic-questiondb-designcant-think/#findComment-1126156 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.