List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 18 2000 10:00pm
Subject:Re: Null Columns in Index
View as plain text  
At 3:47 PM -0500 05-18-2000, Ruben I Safir wrote:
>Gooood Morning to You from Brooklyn USA
>It seems that the Docs say I can put columns which can be null into an
>index, but it fails to work.
>mysql> CREATE TABLE testme (LAST varchar(30), FIRST varchar(30), INDEX
>ERROR 1121: Column 'LAST' is used with UNIQUE or INDEX but is not
>defined as NOT NULL
>Are the docs wrong?

You probably don't have MySQL 3.23.  That's when NULL values in indexes
were allowed.

>KEY is a synonym for INDEX.
>     In MySQL, a UNIQUE key can have only distinct values. An error
>occurs if you try to add a new row with a key that matches an existing
>     row.
>     A PRIMARY KEY is an unique KEY with the extra constraint that all
>key columns must be defined as NOT NULL. In MySQL the key is
>     named PRIMARY. A table can have only one PRIMARY KEY. If you don't
>have a PRIMARY KEY and some applications ask for the
>     PRIMARY KEY in your tables, MySQL will return the first UNIQUE key,
>which doesn't have any NULL columns, as the PRIMARY KEY.
>     A PRIMARY KEY can be a multiple-column index. However, you cannot
>create a multiple-column index using the PRIMARY KEY key
>     attibute in a column specification. Doing so will mark only that
>single column as primary. You must use the PRIMARY
>     KEY(index_col_name, ...) syntax.
>Ruben I Safir
>Perl Notes:
>Manager of Intranet Development NYU College of Dentistry
>Please check "" before
>posting. To request this thread, e-mail mysql-thread37874@stripped
>To unsubscribe, send a message to:
>     <>

Paul DuBois, paul@stripped
Null Columns in IndexRuben I Safir19 May
  • Re: Null Columns in IndexPaul DuBois19 May
  • Re: Null Columns in IndexDana Powers19 May
  • Re: Null Columns in IndexThimble Smith19 May
  • french charactersICARE19 May
    • Re: french charactersThimble Smith19 May