Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help newbee create database

Status
Not open for further replies.

Willy75

Technical User
Mar 27, 2002
2
SI
Hi

I have some problems with creating database. Actually I don't know how many tables must I create for this task:
i have number of items with their propertys. Let's say that they're stored in table tblItems: ItemID, ItemProperty1, ItemProperty2,...
Each item belonging in one or more groups and/or subgroups. New groups and subgroups can be added at any time. So, I create second table tblMainGroups: MainGroupID, ItemID, MainGroup1, MainGroup2,...
But each main group can have subgroups, like this: MainGroup1: MainGroup1Sub1, MainGroup1Sub2,...
MainGroup2: MainGroup2Sub1, MainGroup2Sub2,...
.......
I set relationship between tblItems and tblMainGroups with primary key ItemID and foreign key MainGroupID.
But how about subgroups? I really need advice.
Thank you
Willy
 
You're going to have to be more specific. I can't tell really what you're doing or what sort of subjects the database represents.

First and foremost, the relationship between a Main table and a subset table is maintained by keeping the primary key in the subset table as both the primary key AND the foreign key. It serves both purposes. This is ONLY when there is a one to one relationship between the Main table and subset table. If there is a one to many relationship it's different. I'd explain more, but since I can't really tell what subjects you're dealing with I can't comment exactly.

Go ahead and be specific. Also, it helps if you type things out and you want to put specific spacing in them use the 'code' and '/code' to surround the comments. Click on the "Process TGML" link when you're composing for more information.

Good luck!
Onwards,

Q-
 
Thank you for your response.

Actually i want to create database of functions(procedures). Propertys of every function are: short comment, author of function or procedure, date of last modification, date of creation, function/procedure code and all API functions which this func/proc used to work.
I want to grouping this function. So each function belonging in one or more groups. And each group can have subgroups. Like this: MainGroup: multimedia function > SubGroups: graphic, sound, video,... So each func can belonging in one or more main groups and one or more subgroups.

I created table1: tblFunctions with fields: FunctionID, Comment, Author, DateMod, DateCre, FunctionCode and APIFunc. I set field FunctionID as Primary key. Than I created table2: tblMainGroups with fields: MainGroupID and MainGroup. I set MainGroupID field as Primary Key. And there are Multy To Multy relatioship between this two tables. So I create table3: tblTable3 with fields: FunctionID and MainGroupID. Both set as foreign key. I set one-to-many relationships between tblFunctions and tblTable3 & tblMainGroups and tblTable3. This is only one part of database without subgroups which I don't know how to implement in database. And I don't know if this 3 tables are good solution for this first part of task. So I need some advice.
And yes, we can add new main group when ever we want. Also subgroups of any main groups can be added at any time.
Any suggestions are appreciated.
Willy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top