Click here to Skip to main content
15,895,606 members
Home / Discussions / Database
   

Database

 
GeneralRe: Installing Database Pin
Javier Lozano17-Dec-04 17:58
Javier Lozano17-Dec-04 17:58 
GeneralMore on CRecordset Instances Pin
Chris Meech17-Dec-04 8:22
Chris Meech17-Dec-04 8:22 
GeneralRe: More on CRecordset Instances Pin
Mike Dimmick17-Dec-04 12:33
Mike Dimmick17-Dec-04 12:33 
GeneralRe: More on CRecordset Instances Pin
Chris Meech21-Dec-04 2:00
Chris Meech21-Dec-04 2:00 
GeneralRe: More on CRecordset Instances Pin
Chris Meech21-Dec-04 4:32
Chris Meech21-Dec-04 4:32 
GeneralRe: Category Pin
Brendan Vogt17-Dec-04 2:45
Brendan Vogt17-Dec-04 2:45 
GeneralCategory Pin
Brendan Vogt17-Dec-04 0:13
Brendan Vogt17-Dec-04 0:13 
GeneralRe: Category Pin
Colin Angus Mackay17-Dec-04 2:13
Colin Angus Mackay17-Dec-04 2:13 
You would use a self-referential join. In other words you join the table to itself.

Category
---------------------------------------
ID                int not null
Name              nvarchar(256) not null
ParentCategoryID  int null


The ParentCategoryID is a foreignkey that refers to the ID column in Category. If it is null then it is a root category, if it has a parent then it is a sub-category. You can go as deep as you want (2billion+ subcategories deep if you need it)

This design also does away with the category and sub-category tables and replaces it with just one. Unless you need extra/different things in category and subcategory I'd stick with my design above, if category and sub-category require a different set of columns then the design will have to be with two tables.

Does this help?


Do you want to know more?
WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums


QuestionUNC required ??? Pin
Vector716-Dec-04 23:39
Vector716-Dec-04 23:39 
AnswerRe: UNC required ??? Pin
Colin Angus Mackay17-Dec-04 2:15
Colin Angus Mackay17-Dec-04 2:15 
AnswerRe: UNC required ??? Pin
Jon Hulatt17-Dec-04 3:50
Jon Hulatt17-Dec-04 3:50 
GeneralRe: UNC required ??? Pin
Colin Angus Mackay17-Dec-04 4:11
Colin Angus Mackay17-Dec-04 4:11 
GeneralMSDE Inquiry Pin
Member 150205616-Dec-04 21:49
Member 150205616-Dec-04 21:49 
GeneralRe: MSDE Inquiry Pin
Colin Angus Mackay17-Dec-04 2:20
Colin Angus Mackay17-Dec-04 2:20 
GeneralRe: MSDE Inquiry Pin
Member 150205617-Dec-04 13:29
Member 150205617-Dec-04 13:29 
GeneralRe: MSDE Inquiry Pin
Colin Angus Mackay17-Dec-04 13:32
Colin Angus Mackay17-Dec-04 13:32 
GeneralRe: MSDE Inquiry Pin
Rob Graham24-Dec-04 6:08
Rob Graham24-Dec-04 6:08 
GeneralListView Control Pin
RogerDodge16-Dec-04 21:41
RogerDodge16-Dec-04 21:41 
GeneralSQL Syntax Error Pin
Suresh Prasad16-Dec-04 19:48
Suresh Prasad16-Dec-04 19:48 
GeneralRe: SQL Syntax Error Pin
Colin Angus Mackay17-Dec-04 2:24
Colin Angus Mackay17-Dec-04 2:24 
GeneralRe: SQL Syntax Error Pin
Suresh Prasad17-Dec-04 4:06
Suresh Prasad17-Dec-04 4:06 
GeneralDatagrid update Pin
Yulianto.16-Dec-04 16:15
Yulianto.16-Dec-04 16:15 
GeneralRe: Datagrid update Pin
Veera Raghavendra16-Dec-04 17:20
Veera Raghavendra16-Dec-04 17:20 
GeneralGenerating wrapper code for SQL Server Stored Procedure Pin
Fraas16-Dec-04 15:32
Fraas16-Dec-04 15:32 
General"Artificial" Server" -beginner question Pin
Anonymous16-Dec-04 13:49
Anonymous16-Dec-04 13:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.