On 2 Feb 2011, at 7:48pm, Bert Nelsen wrote:

> customer_lastname
> customer_firstname
> customer_street
> customer_PhonePrivate (will almost always stay empty)
> customer_PhoneCompany
> customer_PhoneMobile
> customer_PhoneWAP (will almost always stay empty)
> customer_Phone1 (will almost always stay empty)
> customer_Phone2 (will almost always stay empty)
> 
> 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=>

It makes more sense to create a property table for your rarely-used columns.  
Remove them from the main table and add another TABLE customer_Properties

customer_Id
property_name
property_value

So if you know two normally-empty phone numbers for a customer that would be 
two entries in the table.  NO reason why you shouldn't use the property table 
for any field which would normally stay empty, for example 
customer_AddressBlling if that is rarely used.

By the way, you did not mention a customer_id column for your main customer 
table.  It is extremely important that you have one, and relate other tables to 
that table using that, rather than the name.  Customers change their names (get 
married, get Knighted, etc.) and you don't want to have to race through the 
rest of your system changing primary keys.

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

Reply via email to