-1

I'm trying to create a table in my database on phpMyAdmin with this code:

CREATE TABLE usuarios (
    nombre VARCHAR NOT NULL,
    passwd VARCHAR NOT NULL,
    correo VARCHAR NOT NULL,
    sexo VARCHAR(1) NOT NULL,
    edad DATE NOT NULL,
    rango INTEGER NOT NULL,
    tipo VARCHAR(1) NOT NULL,
    imagen VARCHAR NOT NULL,
    txt VARCHAR NOT NULL,
    CONSTRAINT nombre_pk PRIMARY KEY (nombre)
);

And I get this problem:

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your server version for the right syntax to use near 'NOT NULL, passwd VARCHAR NOT NULL, correo VARCHAR NOT NULL, sexo ' at line 2

jarlh
  • 42,561
  • 8
  • 45
  • 63

1 Answers1

0

You need lengths for VARCHAR declarations in MySQL. For instance:

CREATE TABLE usuarios (
    nombre VARCHAR(255) NOT NULL,
    passwd VARCHAR(255) NOT NULL,
    correo VARCHAR(255) NOT NULL,
    sexo CHAR(1) NOT NULL,
    edad DATE NOT NULL,
    rango INTEGER NOT NULL,
    tipo VARCHAR(1) NOT NULL,
    imagen VARCHAR(255) NOT NULL,
    txt VARCHAR(255) NOT NULL,
    CONSTRAINT nombre_pk PRIMARY KEY (nombre)
);
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786