Hi,
I need to know whether question 5) below can be answered via SQL syntax, or
do I have to write a program for this?
(Please use fixed font for point 3)
1)
I have a table with three columns: ObjectKey, ObjectAttribute,
AttributeValue.
2)
Primary Key on the Table: Composite - (ObjectKey and ObjectAttribute).
Business Logic: An object can have zero, 1 or more attributes. An object's
attribute can only have one value.
(E.g. Object = The Postman; ObjectAttribute = Sex; AttributeValue = M)
3)
Sample Values:
ObjectKey ObjectAttribute AttributeValue
FOO1 LENGTH 30
FOO1 BREADTH 20
FOO1 LOCATION Plot X
FOO2 LENGTH 40
FOO2 BREADTH 30
FOO3 LOCATION Plot Y
FOO3 COLOUR Brown
4)
Business Logic of the table (reason of existence!): This table will cater
for all sundry attributes of the "objects" - we don't know how many
different attributes exist for these objects, so we need to keep a "dynamic"
table that will allow us to enter new attributes of the objects whenever
they become known.
5)
I need to answer the following business question in SQL syntax (if it is
possible):
"List all Objects that have a Length of 30 and Breadth of 20."
6)
I am using SQL 6.5 and ADO 2.1. However, I want my solution to be DB
independent (ie. I want to solve this business question with a SQL
statement)
Anyone?
Regards
A Kauchali
Johannesburg
South Africa