T
Tony
Hello.
I was in need of a help on building a table that has a category with nested
sub category. I managed to get this help to build the table using SQL
statment.
table structure seems to be very easy. but to do the nested subcat.. it
seems FK refrences PK. what that dose and what exactly that means. ? as i
mentioned i have only single table in my database.
table has 3 field
ID = PK
Name = Text
Parent_id = FK
Statment is :
Create table categories
( id integer not null constraint cat_pk primary key
,name text(50) not null
,constraint parent_fk foreign key (parent_id) refrences categories (id)
)
thats all to it.
any info on refrencing PK from FK would greatly help me to undrestand this
process.
thanks
ps: table name is Categories. i know in order to have FK in my categories
table , i need to have a another table in database that i can use PK of that
table as FK to categories. but i have only one table .
I was in need of a help on building a table that has a category with nested
sub category. I managed to get this help to build the table using SQL
statment.
table structure seems to be very easy. but to do the nested subcat.. it
seems FK refrences PK. what that dose and what exactly that means. ? as i
mentioned i have only single table in my database.
table has 3 field
ID = PK
Name = Text
Parent_id = FK
Statment is :
Create table categories
( id integer not null constraint cat_pk primary key
,name text(50) not null
,constraint parent_fk foreign key (parent_id) refrences categories (id)
)
thats all to it.
any info on refrencing PK from FK would greatly help me to undrestand this
process.
thanks
ps: table name is Categories. i know in order to have FK in my categories
table , i need to have a another table in database that i can use PK of that
table as FK to categories. but i have only one table .