[Wolves] MySQL

Alex Willmer alex at moreati.org.uk
Mon Aug 2 12:43:42 UTC 2010

On 2 August 2010 13:28, Peter Cannon <dick_turpin at archlinux.us> wrote:
> Things I always find confusing is;
> "should it have a key?"

You should _always_ have a primary key. The primary key will often be
single code-like field such as customer_no, customer_id or
customer_num. Occassionally your primary key may be a composite key
over 2 or more fields - but don't worry about that right now.

> "How the hell do I know if its intger?"

Simple rules:
- Is it something you count? Bob ordered 23 widgets -> use an integer.
- Is it something you measure? Bob ordered 23 kg of sand -> use a
NUMBER or float.
- Is it money? Use a number.
- Is it an arbitrary identifier that customers/humans won't normally
see? E.G. employee_id -> use an integer
- Is it an identifier that humans will use and read over the phone?
E.g. "Anti Virus Enterprise 2009 for Linux" -> use a string
product_code = "AV2003-Ent-Lin", and maybe an integer as a primary key
e.g. product_id=1000045

Alex Willmer <alex at moreati.org.uk>

More information about the Wolves mailing list