What are the most common best practices on length and data type on common fields like:
- First Name
- Last Name
- Phone Number
I would tend to be very suspicious of any set of universal best practices because, for most of these fields, the devil is in the details. Just because the information is relatively common doesn't mean that your application uses the data in exactly the same way that other applications use it. That means your data model may need to be slightly different.
Regarding names, consider using double-quotes so you don't have to escape apostrophes in Irish or Italian names (e.g., O'Hara or D'Amato).
I'd also recommend getting a good set of Regular Expressions to use, so you can output parts of your name fields (e.g., first initial, nickname, Jr/Sr, etc.).
My bum is getting sore from sitting on the fence, so I am going to just throw out some answers and hope to not get down-voted into oblivion. Please offer constructive criticism.
min: 6 (email@example.com) . Or 3 if you want to track local domain email addresses
The amount of code to validate an email is actually insane, so let's just assume it's valid if it has a "@"
You may want to abstract an email address as a "communication method", so that you can easily list all methods with which to communicate with a user.
Gender can change over time, so you could track that if it's important to you. Follow http://en.wikipedia.org/wiki/ISO/IEC_5218
I am gonna take the cheap way out and stick to North American addresses.
It is convenient to abstract countries, divisions, cities, and counties mostly due to taxation. Taxes can apply at many levels, so if you can point a tax rate at an abstract geographic area, you are golden.
Add line2, and line3 if you need to.
Now, an address is an address. Multiple people can live at an address, and a person can have multiple addresses at the same time, and over time, so you need a many-many table for that.
A party can have multiple phone numbers, and a phone number can be used by multiple people. A phone number can be used for faxes, telephone calls, modems, etc. and can have extensions. These can all change over time too.
The min might be 3 (for "911"), or maybe 7 ("310-4NET", which is a special kind of local number that does not allow you to dial the area code)
You could split this into country code, etc if necessary.
You should use the http://en.wikipedia.org/wiki/E.164 standard
Names are tough. Here's why:
From a slightly different perspective than the previous answers, and since it seems OK to talk about LDAP, RFC 4519 -- "Lightweight Directory Access Protocol (LDAP): Schema for User Applications" may be of interest.
It may be useful if your application needs to be mapped to such a directory. Otherwise, it's probably not adapted to your requirements.
These definitions are more than just about data, they're also about some operators that can be used on the fields.
In addition to the great answers above, don't forget to accept unicode characters. Just because you are in the US doesn't mean that you don't want to accept foreign characters into your columns.
That said, I usually recommend 50 characters for names. 320 should be more than enough for an email address (you can check the ANSI standard to be sure). For address error on the side of caution with 255 characters. While you'll probably never need an address that big, you might if you include C/O lines and stuff like that. City should be pretty big, there are some pretty long city names out there. For state go with a child table, same with country. For Zip code don't forget about international postal codes which are longer than US zip codes. Just because you don't support international you still might be. There are lots of US citizens who live in different counties including military folks.
Don't forget that state should be optional as many countries don't have states.
You may as well guess based on sample data and expected audience. It depends on your location.
Phone number: International code, length, mobile vs house, allow mobile as only number