If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Keeping fields consistant within a table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-19-07, 05:55
expatriate expatriate is offline
Registered User
 
Join Date: Apr 2006
Posts: 17
Red face Keeping fields consistant within a table

Hello All -

I'm designing a database for a fairly large site with a number of sections (i.e. About, Industry, Clients, etc.)

Generally speaking, all pages within each section have the same layout: Image, headline, subhead, text. Since this was the case, I've decided to name each DB table based upon the section (table - industry) so if someone hits the Industry menu item I just grab the proper page from that table (like "industry > immigration")

My basic field names for the Industry table are like this:

ID - row id
Page - page name
Title - page title text
Headline - page headline
Subhead - page subhead
Image - source path to the image
Text - page text.

So far so good, but then I ran into a "gotcha" in the spec. Also within the industry section is a Q & A page which, naturally, will have multiple subhead fields (for the questions) and multiple text fields (for the answers). Naturally, this is the ONLY page within this section that diverts from the other pages in the industry section.

So, what to do??? What would you do?

Since Q & A could contain any number of question and answers, should I create a seperate table for this one page. This would be a shame because I'm trying to keep the DB as lean and uncluttered (with tables) as possible. The scenario above does, however, somewhat blow my desire.

I haven't been doing DB design for very long, and I can't really come to a better solution than splitting out a table for that one page.

Any comments and suggestions are greatly appreciated.

Expatriate
Reply With Quote
  #2 (permalink)  
Old 02-19-07, 09:35
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
You should not have a separate table for each page type, you should have a single table and indicate via a column the page type.

as for your problem with the industry table, you would add an additional table and use a join to draw the appropriate information out of both tables.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On