Forum Moderators: phranque

Message Too Old, No Replies

Database Design Question - Average Lengths

not sure where to post this - sry

         

Argblat

3:17 pm on May 2, 2005 (gmt 0)

10+ Year Member



I am designing a simple database for an ecommerce project, and I am wondering if anyone knows of posted articles or information regarding averages or safe sizes to allot for various data.

For example...what is a good size to allot for Last Name, First Name, etc. etc.

I will obviously air on the side of caution and allot more space than I think that I will ever need, but I would like to try to waste as little space as possible and/or make an educated decision for future reference (and hopefully future expansion)

Thank you in advance for any knowledge you can share

-Mike

GaryK

3:22 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What database are you using? I ask that because some databases have a variable-length datatype wherein you assign a last name, let's say, 20 characters. But in reality it only uses enough space to store the actual length of any given last name.

Argblat

4:24 pm on May 2, 2005 (gmt 0)

10+ Year Member



For the project that I am currently working on I am using MS SQL Server 2000. However for other projects I may find myself using MySQL. Do you know of any references or published work related to my query on a general scale, covering many db's?

-mike

GaryK

4:29 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



SQL Server has a datatype called varchar/nvarchar. Let's say you define a column as varchar(100). If you only enter 20 characters you won't be wasting the other 80 characters. This gives you a lot of flexibility in how you create your database schema because SQL Server will only allocate 20 characters in this example.