Re: String Search
From: --CELKO-- (jcelko212_at_earthlink.net)
Date: 02/14/05
- Next message: sql rookie: "Re: newbie question on SP, Databases,instances"
- Previous message: --CELKO--: "Re: Drop table problem"
- In reply to: RichieRich: "Re: String Search"
- Messages sorted by: [ date ] [ thread ]
Date: 14 Feb 2005 11:13:34 -0800
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications.
>> I have an identity table with a list of items "groups". <<
What is "an identity table" -- after writing six books on SQL, I have
never heard that term.
>> I also have a list of users and the groups they are assigned to. <<
List? SQL only has tables; LISP and some other languages use list
structures.
>> Then I have another table of "projects" and what groups they belong
to. <<
I can make some guesses based on that vague spec, but I have business
rules about group membership, project assignments, etc.
CREATE TABLE Users
(ssn CHAR(9) NOT NULL PRIMARY KEY,
..);
CREATE TABLE Projects
(proj_nbr INTEGER NOT NULL PRIMARY KEY,
...);
CREATE TABLE ProjectGroups
(grp_nbr INTEGER NOT NULL
REFERENCES Groups(grp_nbr)
ON UPDATE CASCADE
ON DELETE CASCADE,
proj_nbr INTEGER NOT NULL
REFERENCES Projects(proj_nbr)
ON UPDATE CASCADE
ON DELETE CASCADE,
PRIMARY KEY (grp_nbr, proj_nbr),
...);
CREATE TABLE GroupAssignments
(ssn CHAR(9) NOT NULL
REFERENCES Users(ssn)
ON UPDATE CASCADE
ON DELETE CASCADE,
grp_nbr INTEGERE NOT NULL
REFERENCES Groups(grp_nbr)
ON UPDATE CASCADE
ON DELETE CASCADE,
PRIMARY KEY (ssn, grp_nbr)
..);
This makes all kinds of assumptions.
>> I used a column instead of another table that tied the projects to
the groups (I thought it would be less messy). So now the user needs
to query the projects table and only return those projects that the
user belongs to. <<
Why did you think that a project was an attribute (column) and not an
entity (table) in your data model? I am serious about that question.
What is your "native programming language"? Have you worked with a MV
system before this? Etc. People usually have some reasoning behind a
mistake like this. It helps me teach if I know that reasoning.
- Next message: sql rookie: "Re: newbie question on SP, Databases,instances"
- Previous message: --CELKO--: "Re: Drop table problem"
- In reply to: RichieRich: "Re: String Search"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|