Reputation: 263
I created a database named resultsDB
. Inside the resultsDB
is a table called tblContinent
. Now I want to create another table inside the tblContinent
called tblAsia
and inside the tblAsia
are columns such as Philippines
,Japan
,Korea
, Thailand
and so on. I'm trying to generate them in phpmyadmin
but no luck. Is it possible what I want to do? Any suggestions?
Upvotes: 3
Views: 11917
Reputation: 2106
just an example to the @Mahida's sol:
1. Parent table Automobile {Auto ID}
Child tables
1. Car {Auto ID,CarID}
2. Truck {Auto ID,Trucks ID}
3. Bus {Auto ID,BusID}
Here Auto ID column is a Primary key to Automobile table and foreign to Car,Truck,Bus tables. Hope you got what you need.
Upvotes: 3
Reputation: 2366
There is no concept of nested table in mysql.
But you can archive same things by settings relationships of parent child tables. I mean using primary key and foreign key.
create : tblContinent
Id (PK)
Name
create : tblCountry
ID (PK)
CID (foreign Key to tableContinent)
Name
So, this way you will have list of all continent and the country in each continent.
Hope it helps..!!!!
Upvotes: 4