A MAC address is just a number, it doesn't contain letters unless you're doing something
silly like storing the HEX representation of it. Do not use CHAR! This does DOUBLE for
all of you storing IP addresses!
Since a MAC address is going to be between 48 and 64 bits, then BIGINT is appropriate.
When you select the value you can do SELECT HEX(mac) FROM table; to get a more readable
version of it. When you're storing values you can do: INSERT INTO table (mac) VALUES
(x'FFEEDDCCBBAA9988'); to convert a hex string to the numeric value.
Date: Thu, 14 May 2009 09:53:58 -0400
To: Ilia KATZ <ikatz@stripped>
From: Fish Kungfu <fish.kungfu@stripped>
Subject: Re: MAC address as primary key - BIGINT or CHAR(12)
Content-Type: text/plain; charset=ISO-8859-1
Since MAC addreses also contain letters, BIGINT wouldn't work. So, yes, I
would say go with CHAR(12).
On May 14, 2009 9:43 AM, "Ilia KATZ" <ikatz@stripped> wrote:
Currently I have a table:
1. MAC address defined as BIGINT
2. MAC address set as primary key
Should I consider changing it to CHAR(12)?
Replies will be appreciated.
The information contained in this transmission may contain privileged and confidential
information. It is intended only for the use of the person(s) named above. If you are not
the intended recipient, you are hereby notified that any review, dissemination,
distribution or duplication of this communication is strictly prohibited. If you are not
the intended recipient, please contact the sender by reply email and destroy all copies of
the original message.