•
•
•
•
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
![]() |
•
•
Join Date: Jun 2005
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
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?
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?
•
•
Join Date: Jul 2005
Location: Dallas, TX
Posts: 481
Reputation:
Rep Power: 4
Solved Threads: 19
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)
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)
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- help wif uploading My sql database into Phpmyadmin.com (MySQL)
- Cities and Districts DataBase - Basic Question (Database Design)
- Database structure program (Windows Software)
- Database-Structure Backup (MS SQL)
- Can not fill dataset from database on other computer with ASP .NET and MS Access (Visual Basic 4 / 5 / 6)
- object undefined instead of string literal (JavaScript / DHTML / AJAX)
- Begginer here needs help (C)
Other Threads in the MySQL Forum
- Previous Thread: Mysql Php Image Help Please!!!
- Next Thread: configure PHP to work with Mysql


Here's how I would do this:
Linear Mode