User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 427,314 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,842 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 1442 | Replies: 2
Reply
Join Date: Jun 2005
Posts: 3
Reputation: DieselPower220 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
DieselPower220 DieselPower220 is offline Offline
Newbie Poster

Help database structure - boohooo help me

  #1  
May 23rd, 2006
I have been trying to learn this database thing for the last 3 months without much success , its understanding the structure that puzzles me the most

say for example i want a page listing all types of fruit

oranges
apples
bananas
grapes

then i would want another page listing just apples which would show all names available in that gategory

example
grannys smiths, pink lady, golden delicious etc etc (names of apples)

and then another page just for granny smiths and so on.

how would i structure the tables in a database to do this?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation: campkev is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: database structure - boohooo help me

  #2  
May 23rd, 2006
well, depending on the situation, there are many ways you could do it, one would be:

tblFruit
fruitID int
fruitName varchar(25)

tblFruitSub1
Sub1ID int
fruitID int //foreign key to tblFruit.fruitID
Name varchar(25)

tblFruitSub2
Sub2ID int
Sub1ID int //foreign key to tblFruitSub1.Sub1ID
Name varchar(25)
Reply With Quote  
Join Date: May 2006
Posts: 5
Reputation: VioletSite is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
VioletSite's Avatar
VioletSite VioletSite is offline Offline
Newbie Poster

Solution Re: database structure - boohooo help me

  #3  
May 27th, 2006
Here's how I would do this:

tblFruit_Names
fruit_NameID int//Optional (depends on further processing needs)
fruit_Name varchar(25)
Fruit_TypeID int//foreign key to tblFruit_Types.fruitID

tblFruit_Types
fruit_TypeID int//foreign key to tblFruit_Names.fruitID
fruit_Type_Name varchar(25)
"Those who know, don't need to be told. Those who don't; seldom listen." -- Ashida Kim

Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 2:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC