Iím trying to create a members table in MySQL using the Email address of the member as a primary key. So, with my limited knowledge of SQL, I type in the following command at the TelNet prompt:
CREATE TABLE Member (
Email TEXT NOT NULL PRIMARY KEY,
Iím then, however, presented with the following error message:
ERROR 1073: BLOB column ĎEmailí canít be used in key specification
Why am I getting this error, and how do I create a table with the Email address as the primary key?
Thanks in advance !
Without knowing much about this - it doesn't suprise me if MySQL doesn't allow you to use a text field as a primary key, because the primary key is automatically indexed it would be a very ineffiecent index (given that a text field is <scientific term> bloody big </scientific term>).
Use a varchar type instead. How many characters would be enough for an email? - 100?
Email VARCHAR(100) NOT NULL PRIMARY KEY
Yes Sid is right on.
You shouldn't use a text field anyways since its inefficient. Use varchar for things like Name, Email, etc. text should only be used for storing articles, or books, or other long things.
Thanks for the help, guys! I really appreciate it!