dark22horse Posted July 15, 2007 Share Posted July 15, 2007 Hi guys, Im starting a new project, just to help me get to grips with php and mysql! I was hoping that some one could check my table designs, as im not sure they are quite right. House// House ID - Auto inc + unique photo ID User ID summary tenure Type ID Price bedrooms Reception rooms bathrooms county town/city condition floor plan details post code location type chain features map User// user ID Username password email photos// Photo ID photo type// Type ID Type Is this normalised? I think I have done some of it, but not done this for a while, so cant quite remember! Quote Link to comment Share on other sites More sharing options...
xenophobia Posted July 16, 2007 Share Posted July 16, 2007 Maybe the type is unnecessary for it to store in other table, since it only have one field. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 16, 2007 Share Posted July 16, 2007 If you're House.PhotoID is only going to point to a record with a single other value, you might as well just store that other value in the House table. However, what happens if I want to upload multiple pictures for a single house? Your current design would require multiple duplicate records in the House table with only the PhotoID field changing. I suggest removing PhotoID from the House table altogether. Instead, change your Photo table to: id houseID file Then you will be able to upload multiple files for a single house. Quote Link to comment Share on other sites More sharing options...
dark22horse Posted July 16, 2007 Author Share Posted July 16, 2007 Maybe the type is unnecessary for it to store in other table, since it only have one field. From the books I have read, it says do this because it makes searching easy? is that correct? or shall I just stick it in the house table? Quote Link to comment Share on other sites More sharing options...
paul2463 Posted July 16, 2007 Share Posted July 16, 2007 it is better to leave type as a table all of its own so you can restrict what the users can put in there, you can create a drop down select box of types you are allowing them by just querying that one table and placing the type_id in the house table Quote Link to comment 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.