Nadine: Was mach ich falsch ?

Hallo,

wollte in PHPMyAdmin eine neue Tabelle anlegen, habe das auch versucht aber jetzt kommt die Meldung was mache ich falsch ?

Gruß Nadine

MELDUNG:

SQL-Befehl :

CREATE TABLE pm (

fromid INT( 10 ) UNSIGNED NOT NULL ,
fromuser VARCHAR( 20 ) NOT NULL ,
toid INT( 10 ) UNSIGNED NOT NULL ,
touser VARCHAR( 20 ) NOT NULL ,
betreff VARCHAR( 128 ) NOT NULL ,
date VARCHAR( 10 ) NOT NULL ,
text TEXT NOT NULL ,
readjet ENUM NOT NULL ,
id INT( 10 ) NOT NULL ,
PRIMARY KEY ( text )
)

MySQL meldet:

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL, id INT(10) NOT NULL, PRIMARY KEY (text))' at line

  1. Halihallo Nadine

    readjet ENUM NOT NULL ,

    ^^^
    ENUM('wert1','wert2',...)

    'wert1','wert2',... gibst du in phpMyAdmin dort ein, wo du sonst die
    Länge für (VAR)CHAR, INT, ... Typen festlegst.

    #1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL, id INT(10) NOT NULL, PRIMARY KEY (text))' at line

    Das nächste mal Doku-lesen:
    http://dev.mysql.com/doc/mysql/en/ENUM.html
    http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html

    Viele Grüsse

    Philipp

    --
    M$: Patches - don't.
    1. Hallo Philipp,

      danke für deine Hilfe,

      jetzt kommt aber noch die Meldung :-((

      #1170 - BLOB column 'text' used in key specification without a key length

      Gruß Nadine

      1. Halihallo Nadine

        #1170 - BLOB column 'text' used in key specification without a key length

        http://dev.mysql.com/doc/mysql/en/BLOB.html
        You can have indexes on BLOB and TEXT columns only as of MySQL
        3.23.2. Older versions of MySQL did not support indexing these
        column types.
        For indexes on BLOB and TEXT columns, you must specify an index
        prefix length. For CHAR and VARCHAR, a prefix length is optional.

        => Lies die zuvor gepostete Ressource bezgl. CREATE TABLE und lies
        nach, wie man dem Index eine fixe Länge zuweist.

        Ein PrimaryKey über den Datentypen TEXT? - Ich muss ernsthafte
        Zweifel über den Sinn dessen äussern. Weisst du eigentlich was du
        tust? - Befasse dich mit nummerischen ID's und autoinc, mehr dazu
        wie immer in der Doku zu lesen.

        Viele Grüsse

        Philipp

        --
        M$: Patches - don't.