dbTalk Databases Forums  

Re: Adding unlimited columns to a table

comp.databases comp.databases


Discuss Re: Adding unlimited columns to a table in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Yoo-Jin Lee
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 07-30-2003 , 08:42 AM






Ed,

Thanks for replying.

I have not misinterpreted the requirement as stated. Unfortunately, being a
developer you have to code for whatever requirement you're given - no matter
how silly it may seem. Populating the table will come out of how data is
being stored.


Thanks anyhow.

-Yoo-Jin

"Ed prochak" <ed.prochak (AT) magicinterface (DOT) com> wrote

Quote:
"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote

Hi,
I'm working on a project to allow users to search a database table. The
requirement is to have unlimited keys (columns) of string or integer. At
anytime users can add a column of an integer or varchar to a table in
any
SQL 92 complaint database. We had a consultant visit who recommended
against
modelling the project on a database schema that constantly changes. His
reasons were due to future updates to the project. I can't think of
anyway
to do it.

Here's a Java approach. Initially, my thoughts were to create a table
(tblMyData) with one column for the unique identifier. The user then
adds
columns of varchar or integer. An bmp ejb could model the metadata of
tblMyData so that a search string could be constructed. jdbc would be
used
to directly access tblMyData.

Is this bad design? Thoughts?

Sounds bad to me. How are they going to populate all those new
columns? What a messy idea. Take a step back from the details. What
problem are your REALLY trying to solve? Who made that (unlimited
keys) a requirement of your project? Is your understanding of it
truely what they mean by that?

I can see an alternate interpretation: unlimited keys means being able
to SEARCH based on any key in any table. That's a much different
requirement don't you think? (And one that is actually possible to
implement!)

Anyother way to do this?

Not as you initially proposed.
[]
Thanks for your thoughts.

-Yoo-Jin

You are welcome. HTH

Ed



Reply With Quote
  #2  
Old   
Jim Kennedy
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 07-30-2003 , 09:17 AM








"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote

Quote:
Ed,

Thanks for replying.

I have not misinterpreted the requirement as stated. Unfortunately, being
a
developer you have to code for whatever requirement you're given - no
matter
how silly it may seem. Populating the table will come out of how data is
being stored.


Thanks anyhow.

-Yoo-Jin

"Ed prochak" <ed.prochak (AT) magicinterface (DOT) com> wrote in message
news:4b5394b2.0307300526.2a8cec5d (AT) posting (DOT) google.com...
"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote in message
news:<bg878v$6rc$1 (AT) sparta (DOT) btinternet.com>...
Hi,
I'm working on a project to allow users to search a database table.
The
requirement is to have unlimited keys (columns) of string or integer.
At
anytime users can add a column of an integer or varchar to a table in
any
SQL 92 complaint database. We had a consultant visit who recommended
against
modelling the project on a database schema that constantly changes.
His
reasons were due to future updates to the project. I can't think of
anyway
to do it.

Here's a Java approach. Initially, my thoughts were to create a table
(tblMyData) with one column for the unique identifier. The user then
adds
columns of varchar or integer. An bmp ejb could model the metadata of
tblMyData so that a search string could be constructed. jdbc would be
used
to directly access tblMyData.

Is this bad design? Thoughts?

Sounds bad to me. How are they going to populate all those new
columns? What a messy idea. Take a step back from the details. What
problem are your REALLY trying to solve? Who made that (unlimited
keys) a requirement of your project? Is your understanding of it
truely what they mean by that?

I can see an alternate interpretation: unlimited keys means being able
to SEARCH based on any key in any table. That's a much different
requirement don't you think? (And one that is actually possible to
implement!)

Anyother way to do this?

Not as you initially proposed.
[]
Thanks for your thoughts.

-Yoo-Jin

You are welcome. HTH

Ed


Ed is correct. This is a "requirement" that bears some questioning. If you
went to an architect and said "I need a house with the ability to have an
unlimited number of different rooms at the flick of a switch." What do you
think the architect would say. (after he picked himself off the ground and
stopped laughing)

Sure it is possible to do what you suggest and you will end up with a
totally unmaintainable system, difficult or almost impossible to generate
queries for, slow, unscalable etc. So are you saying the unlimited
"requirement" is more important than those other requirements. (eg
maintainability, performance, scalability) Just because it is a
"requirement" doesn't mean it is reasonably implemental or that it should be
done. I would dig deeper and find out what the business problem that is
trying to solve is. Not the business solution, the business problem. (the
unlimited columns is a business solution, not a business problem) Post the
business problem and I bet you will get some excellent suggestions on how to
solve the business problem.

Jim




Reply With Quote
  #3  
Old   
Yoo-Jin Lee
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 08-01-2003 , 03:43 AM



Ok,

The business problem is that we have a search engine based on an item. Each
item has keys associated with it. This engine needs to be configurable for
each different organisation that uses it. The problem is that each
organisation wants to attach a different number of keys to an item.

ie.
Company A - wants to add 20 string keys, 3 number keys, and 10 date keys to
each item.

Company B - wants to add 13 string keys, 2 number keys, and 4 date keys to
each item.

When I said unlimited of course no company is going to add 1 million keys to
an item it's just has that potential.

-Yoo-Jin

"Jim Kennedy" <kennedy-down_with_spammers (AT) no_spam (DOT) comcast.net> wrote in
message news:5sQVa.19230$Ho3.3872 (AT) sccrnsc03 (DOT) ..
Quote:

"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote in message
news:bg8hvp$2ie$1 (AT) titan (DOT) btinternet.com...
Ed,

Thanks for replying.

I have not misinterpreted the requirement as stated. Unfortunately,
being
a
developer you have to code for whatever requirement you're given - no
matter
how silly it may seem. Populating the table will come out of how data is
being stored.


Thanks anyhow.

-Yoo-Jin

"Ed prochak" <ed.prochak (AT) magicinterface (DOT) com> wrote in message
news:4b5394b2.0307300526.2a8cec5d (AT) posting (DOT) google.com...
"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote in message
news:<bg878v$6rc$1 (AT) sparta (DOT) btinternet.com>...
Hi,
I'm working on a project to allow users to search a database table.
The
requirement is to have unlimited keys (columns) of string or
integer.
At
anytime users can add a column of an integer or varchar to a table
in
any
SQL 92 complaint database. We had a consultant visit who recommended
against
modelling the project on a database schema that constantly changes.
His
reasons were due to future updates to the project. I can't think of
anyway
to do it.

Here's a Java approach. Initially, my thoughts were to create a
table
(tblMyData) with one column for the unique identifier. The user then
adds
columns of varchar or integer. An bmp ejb could model the metadata
of
tblMyData so that a search string could be constructed. jdbc would
be
used
to directly access tblMyData.

Is this bad design? Thoughts?

Sounds bad to me. How are they going to populate all those new
columns? What a messy idea. Take a step back from the details. What
problem are your REALLY trying to solve? Who made that (unlimited
keys) a requirement of your project? Is your understanding of it
truely what they mean by that?

I can see an alternate interpretation: unlimited keys means being able
to SEARCH based on any key in any table. That's a much different
requirement don't you think? (And one that is actually possible to
implement!)

Anyother way to do this?

Not as you initially proposed.
[]
Thanks for your thoughts.

-Yoo-Jin

You are welcome. HTH

Ed



Ed is correct. This is a "requirement" that bears some questioning. If
you
went to an architect and said "I need a house with the ability to have an
unlimited number of different rooms at the flick of a switch." What do you
think the architect would say. (after he picked himself off the ground and
stopped laughing)

Sure it is possible to do what you suggest and you will end up with a
totally unmaintainable system, difficult or almost impossible to generate
queries for, slow, unscalable etc. So are you saying the unlimited
"requirement" is more important than those other requirements. (eg
maintainability, performance, scalability) Just because it is a
"requirement" doesn't mean it is reasonably implemental or that it should
be
done. I would dig deeper and find out what the business problem that is
trying to solve is. Not the business solution, the business problem. (the
unlimited columns is a business solution, not a business problem) Post
the
business problem and I bet you will get some excellent suggestions on how
to
solve the business problem.

Jim





Reply With Quote
  #4  
Old   
Jim Kennedy
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 08-01-2003 , 05:11 AM




"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote

Quote:
Ok,

The business problem is that we have a search engine based on an item.
Each
item has keys associated with it. This engine needs to be configurable for
each different organisation that uses it. The problem is that each
organisation wants to attach a different number of keys to an item.

ie.
Company A - wants to add 20 string keys, 3 number keys, and 10 date keys
to
each item.

Company B - wants to add 13 string keys, 2 number keys, and 4 date keys to
each item.

When I said unlimited of course no company is going to add 1 million keys
to
an item it's just has that potential.

-Yoo-Jin

"Jim Kennedy" <kennedy-down_with_spammers (AT) no_spam (DOT) comcast.net> wrote in
message news:5sQVa.19230$Ho3.3872 (AT) sccrnsc03 (DOT) ..


"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote in message
news:bg8hvp$2ie$1 (AT) titan (DOT) btinternet.com...
Ed,

Thanks for replying.

I have not misinterpreted the requirement as stated. Unfortunately,
being
a
developer you have to code for whatever requirement you're given - no
matter
how silly it may seem. Populating the table will come out of how data
is
being stored.


Thanks anyhow.

-Yoo-Jin

"Ed prochak" <ed.prochak (AT) magicinterface (DOT) com> wrote in message
news:4b5394b2.0307300526.2a8cec5d (AT) posting (DOT) google.com...
"Yoo-Jin Lee" <yoojin (AT) aps-cambridge (DOT) co.uk> wrote in message
news:<bg878v$6rc$1 (AT) sparta (DOT) btinternet.com>...
Hi,
I'm working on a project to allow users to search a database
table.
The
requirement is to have unlimited keys (columns) of string or
integer.
At
anytime users can add a column of an integer or varchar to a table
in
any
SQL 92 complaint database. We had a consultant visit who
recommended
against
modelling the project on a database schema that constantly
changes.
His
reasons were due to future updates to the project. I can't think
of
anyway
to do it.

Here's a Java approach. Initially, my thoughts were to create a
table
(tblMyData) with one column for the unique identifier. The user
then
adds
columns of varchar or integer. An bmp ejb could model the metadata
of
tblMyData so that a search string could be constructed. jdbc would
be
used
to directly access tblMyData.

Is this bad design? Thoughts?

Sounds bad to me. How are they going to populate all those new
columns? What a messy idea. Take a step back from the details. What
problem are your REALLY trying to solve? Who made that (unlimited
keys) a requirement of your project? Is your understanding of it
truely what they mean by that?

I can see an alternate interpretation: unlimited keys means being
able
to SEARCH based on any key in any table. That's a much different
requirement don't you think? (And one that is actually possible to
implement!)

Anyother way to do this?

Not as you initially proposed.
[]
Thanks for your thoughts.

-Yoo-Jin

You are welcome. HTH

Ed



Ed is correct. This is a "requirement" that bears some questioning. If
you
went to an architect and said "I need a house with the ability to have
an
unlimited number of different rooms at the flick of a switch." What do
you
think the architect would say. (after he picked himself off the ground
and
stopped laughing)

Sure it is possible to do what you suggest and you will end up with a
totally unmaintainable system, difficult or almost impossible to
generate
queries for, slow, unscalable etc. So are you saying the unlimited
"requirement" is more important than those other requirements. (eg
maintainability, performance, scalability) Just because it is a
"requirement" doesn't mean it is reasonably implemental or that it
should
be
done. I would dig deeper and find out what the business problem that is
trying to solve is. Not the business solution, the business problem.
(the
unlimited columns is a business solution, not a business problem) Post
the
business problem and I bet you will get some excellent suggestions on
how
to
solve the business problem.

Jim




There are a variety of search engines out there. Consider buying one.
Jim




Reply With Quote
  #5  
Old   
programmer
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 08-01-2003 , 05:20 AM



Quote:
The business problem is that we have a search engine based on an item.
Each
item has keys associated with it. This engine needs to be configurable for
each different organisation that uses it. The problem is that each
organisation wants to attach a different number of keys to an item.



create table Zitem(itemID int, description char(128), cost decimal(10,2),
primary key (itemID));

insert into Zitem values (1, 'this is item 1', 2.34);
insert into Zitem values (2, 'this is item 2', 7.63);
insert into Zitem values (3, 'this is item 3', 102.34);
insert into Zitem values (4, 'this is item 4', 0.65);
insert into Zitem values (5, 'this is item 5', 1.99);

select * from Zitem

create table Zitemkey(itemID int, keyID int, stringKey char(32), intKey int,
primary key (itemID, keyID))

insert into Zitemkey values (1,1,'this',null);
insert into Zitemkey values (2,1,'this',null);
insert into Zitemkey values (3,1,'this',null);
insert into Zitemkey values (4,1,'this',null);
insert into Zitemkey values (5,1,'this',null);
insert into Zitemkey values (1,2,'is',null);
insert into Zitemkey values (1,5,null,1);
insert into Zitemkey values (2,5,null,2);
insert into Zitemkey values (3,5,null,3);
insert into Zitemkey values (4,5,null,4);
insert into Zitemkey values (5,5,null,5);

select * from ZItem, ZItemkey
where stringkey='this'
and Zitem.itemid = zitemkey.itemid


The values in ZItemKey will have to be kept up-to-date, probably by using a
trigger on the ZItem table




Reply With Quote
  #6  
Old   
Jerry Gitomer
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 08-01-2003 , 01:01 PM



Yoo-Jin Lee wrote:
Quote:
Ok,

The business problem is that we have a search engine based on an item. Each
item has keys associated with it. This engine needs to be configurable for
each different organisation that uses it. The problem is that each
organisation wants to attach a different number of keys to an item.

ie.
Company A - wants to add 20 string keys, 3 number keys, and 10 date keys to
each item.

Company B - wants to add 13 string keys, 2 number keys, and 4 date keys to
each item.

When I said unlimited of course no company is going to add 1 million keys to
an item it's just has that potential.

-Yoo-Jin

You are describing a problem that sounds suspiciously like one
that is ideal for a data warehouse solution -- at least as far
as retrieving data is concerned. If you can either batch any
inserts and run them during the off hours or you have a
relatively low volume of inserts you should be investigating a
data warehouse solution.

Another solution alternative you should be looking at is a text
based search engine.

If you do decide on either of these approaches be aware of the
need for an incredible amount of disk space (relative to that
needed for storing the data) being required for the storage of
indexes.




Reply With Quote
  #7  
Old   
Anthony W. Youngman
 
Posts: n/a

Default Re: Adding unlimited columns to a table - 08-11-2003 , 05:56 PM



In article <bg878v$6rc$1 (AT) sparta (DOT) btinternet.com>, Yoo-Jin Lee
<yoojin (AT) aps-cambridge (DOT) co.uk> writes
Quote:
Hi,
I'm working on a project to allow users to search a database table. The
requirement is to have unlimited keys (columns) of string or integer. At
anytime users can add a column of an integer or varchar to a table in any
SQL 92 complaint database. We had a consultant visit who recommended against
modelling the project on a database schema that constantly changes. His
reasons were due to future updates to the project. I can't think of anyway
to do it.

Having read your other stuff, if you've got a db-programmer type guy at
customers, why not try a Pick-like back end?

Adding new fields "on the fly" is no problem, and could easily be done
programmatically. Most (all?) Pick-likes support SQL queries, and will
index on fields. They are text-based databases and frugal with disk
space...

And you can download various freebies to try - there's jbase
(www.jbase.com), UniVerse and Unidata from IBM, and there's supposed to
be a freebie Pick itself (now called D3) from Raining Data.

Post on comp.databases.pick for more advice and/or help if you want to
investigate this route.

Cheers,
Wol
--
Anthony W. Youngman <pixie (AT) thewolery (DOT) demon.co.uk>
'Yings, yow graley yin! Suz ae rikt dheu,' said the blue man, taking the
thimble. 'What *is* he?' said Magrat. 'They're gnomes,' said Nanny. The man
lowered the thimble. 'Pictsies!' Carpe Jugulum, Terry Pratchett 1998
Visit the MaVerick web-site - <http://www.maverick-dbms.org> Open Source Pick


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.