Is it possible to make a database reusable for various applications that
will be design in the future?
e.g.
- Project A and Project B and Project C require a 'member' table.
- Project A requires the name and email only.
- Project B requires the name, email, address only.
- Project C requires the name, email, address, gender only.
- Project D...
- Project E......
- ...
if possible, do tell me how.. thanks.
Jerry Gitomer - 26 Jan 2005 13:47 GMT
> Is it possible to make a database reusable for various applications that
> will be design in the future?
[quoted text clipped - 9 lines]
>
> if possible, do tell me how.. thanks.
Design for Project C and use views for Projects A and B.
HTH
Jerry
- - 26 Jan 2005 14:14 GMT
> Design for Project C and use views for Projects A and B.
ouh.. so that's what views are for. thanks.
Neo - 26 Jan 2005 19:17 GMT
> Project A and Project B and Project C require a 'member' table.
> Project A requires the name and email only.
> Project B requires the name, email, address only.
> Project C requires the name, email, address, gender only....
The script below for a small experimental db models the above in a
normalized manner. The db allows each thing to have any number of
classifications and properties; each property can have any number of
values; and each value can have any number of types. Constraints (ie
which attributes are appropriate for a thing) aren't enforced by the db
and need to be implemented in user's code.
// Create items in directory to classify things.
(CREATE *project.item ~in = dir)
(CREATE *person.item ~in = dir)
(CREATE *email.item ~in = dir)
(CREATE *address.item ~in = dir)
(CREATE *gender.item ~in = dir)
// Create verb to relate person to project
(CREATE *member.cls = verb)
// Create projects A, B, C.
(CREATE *projectA.cls = project)
(CREATE *projectB.cls = project)
(CREATE *projectC.cls = project)
// Create projectA member with name and email.
(CREATE *.name = +john)
(CREATE john.cls = person)
(CREATE john.email = +"j@hot.com")
(CREATE projectA.member = john)
// Create projectB member with name, email and address.
(CREATE *.name = +mary)
(CREATE mary.cls = person)
(CREATE mary.email = +"m@hot.com")
(CREATE mary.address = +"123 main st")
(CREATE projectB.member = mary)
// Create projectC member with name, email, address and gender.
(CREATE *.name = +bob)
(CREATE bob.cls = person)
(CREATE bob.email = +"b@hot.com")
(CREATE bob.address = +"456 walnut st")
(CREATE bob.gender = +"male")
(CREATE projectC.member = bob)
// Find projects that has a member that is male.
// Finds projectC.
(SELECT %.member=(%.gender=male))