[comp.databases] How do I handle wide SQL-tables

andrew@resam.dk (Leif Andrew Rump) (07/15/90)

I read in my (Oracle) SQL manual that I should keep my tables as "thin"
as possible but what do I do when I have a lot of information that only
has one key? The example below look a lot like what I have:

+------------------+------+------+-----------+----------+-------+-----+-...
! Social security# ! Name ! Born ! Telefone# ! Roadname ! Road# ! Zip ! ...
+------------------+------+------+-----------+----------+-------+-----+-...

This table gets quite wide - should I do anything with it?

The next question (I haven't got to that part of the manual yet so if you
are able to tell me where it is in Oracle 6.0 manual feel free to tell me!):
I use Pro*C and I want to be able to search on whatever the user enters,
like Name and birthdate (Born) or Name and Telefone# or ... Do I have to
make a SELECT for every possibility:

  select * from State where Name='Leif Andrew Rump' and Born='02-AUG-63';
  select * from State where Name='Leif Andrew Rump' and Telefon#='35822770';


Thank you in advance

Leif Andrew


Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark
UUCP: andrew@ambra.dk, phone: +45 39 27 11 77                /
Currently at Scandinavian Airline Systems                =======/
UUCP: andrew@resam.dk, phone: +45 32 32 22 79                \
SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark

> > Read oe as: o <backspace> / (slash) and OE as O <backspace> / (slash) < <

callisto@blake.acs.washington.edu (Finn) (07/17/90)

In article <1990Jul15.112644.676@resam.dk> andrew@resam.dk (Leif Andrew Rump) writes:
>
>The next question (I haven't got to that part of the manual yet so if you
>are able to tell me where it is in Oracle 6.0 manual feel free to tell me!):
>I use Pro*C and I want to be able to search on whatever the user enters,
>like Name and birthdate (Born) or Name and Telefone# or ... Do I have to
>make a SELECT for every possibility:
>
>  select * from State where Name='Leif Andrew Rump' and Born='02-AUG-63';
>  select * from State where Name='Leif Andrew Rump' and Telefon#='35822770';
>

First off.. I am using SQL in RBASE 3.0 not ORACLE, but I have a similar 
situation.  If the table is very wide at all, there will be an unacceptably
large number of possible combinations of search criteria, so the select for
every possibility is right out.
  
 What I did is have the user edit a form, filling in anything he knows about
the data that he is looking for.
 
 I then construct a search string using each variable that is not null and
then execute the search string.  (RBASE allows this by using the command
 &VARNAME )
 
 Other enhancements to think about are using the LIKE statement so you can
search with .. Name like '%Rump%'
 If there is a numeric or date value, use a trigger to pup up a menu with
 operators if the value is filled in so you can get searches  like
 ..Name like '%rump%' and BORN > '01-JAN-60'

If this isn't clear, mail me and I'll return you the code in mail, it's
a bit long to be publishing on the net.