A
A
Alexander Ivanov2014-08-26 21:58:45
SQL
Alexander Ivanov, 2014-08-26 21:58:45

What site would you recommend for creating categories and subcategories in SQL?

I'm pretty good with relational databases in access (creating schemas and relationships in visual mode), but I don't understand how it works in SQL.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergeyj, 2014-08-26
@cimonlebedev

hmm...i don't understand the question.
entity_id - INT
category_entity_id - int (link to table_category.entity_id)
entity_id - INT
parent_id - INT // parent id
category_name - varchar
So, no?

A
Alexander Ivanov, 2014-08-26
@cimonlebedev

Maybe so, but in this diagram they are also considered as subcategories?
It's just that I think I'm making it harder for myself by trying to do it via CONSTRAINT like in the example below:

CREATE TABLE my_subcat_2(
   id_subcat_2 NUMBER
 , subcat_2_name VARCHAR2(100) NOT NULL
 , CONSTRAINT my_subcat_2#p
      PRIMARY KEY(id_subcat_2)
 , CONSTRAINT my_subcat_2#R#my_master
      FOREIGN KEY(id_subcat_2)
      REFERENCES my_master(id_master)      
   )
;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question