On 2/2/11 11:48 AM, "Bert Nelsen" <bert.nel...@googlemail.com> wrote:

> Because I felt so stupid about these mostly empty columns taking so much
> space, I tended to replace all the "phone" columns by a single column named
> "customerPhone".
> I stored the values into customerPhone like that:
> 
> <cpp=><cpc=><cpm=93829343><cpw=><cp1=234928734><cp2=>
> 
> This is kind of an xml design, but it works and it takes up less space.
> I "decompile" this weird expression at runtime to get the separate values
> again.
> 
> Can I get an opinion on it?

It'll work so long as you don't want to write queries that discriminate
based on the kind of phone number, or on the phone number content.  You
might want to query customers by area code, for example, or get all
customers with a cell phone number.

A third approach would be to add an additional table with three columns:

* customer_id
* phone_number_type
* phone_number

Then JOIN that to your customer table.  Saves space, and lets you do the
two kinds of query I mention above.

Will


> I have not found any good information on the number of columns and
> relationship between their count and speed and diskspace used.
> 
> Thank you very much!
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

--
Will Duquette -- william.h.duque...@jpl.nasa.gov
Athena Development Lead -- Jet Propulsion Laboratory
"It's amazing what you can do with the right tools."


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to