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:
>Monty
>
>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
>(LAST, FIRST));
>ERROR 1121: Column 'LAST' is used with UNIQUE or INDEX but is not
>defined as NOT NULL
>mysql>
>
>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
>
>ruben@stripped
>ruben@stripped
>
>Perl Notes:
>http://www.wynn.com/jewish/perl_course
>
>http://www.brooklynonline.com
>Manager of Intranet Development NYU College of Dentistry
>Resume:  http://www.wynn.com/jewish/resume.html
>
>--
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>posting. To request this thread, e-mail mysql-thread37874@stripped
>
>To unsubscribe, send a message to:
>     <mysql-unsubscribe-paul=snake.net@stripped>


-- 
Paul DuBois, paul@stripped
Thread
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