Search code examples
mysqlcreate-table

SQL create table code


I'm trying to create two MySql tables

CREATE TABLE customer (
     custID int(11) NOT NULL AUTO_INCREMENT,
     custName varchar(50) NOT NULL,
     custPwd varchar(64) NOT NULL,
     custEmail varchar(100) NOT NULL,
     custPhone varchar(10) NOT NULL,
     PRIMARY KEY (custID))

CREATE TABLE request (  
    requestID int(11) NOT NULL AUTO_INCREMENT,
    custID int(11) NOT NULL,    
    requestDate date NOT NULL,
    itemDesc varchar(200) NOT NULL,
    itemWeight int(11) NOT NULL,
    puAdd varchar(100) NOT NULL,
    puSuburb varchar(50) NOT NULL,
    puDate date NOT NULL,
    puTime time NOT NULL,
    dName varchar(50) NOT NULL,
    dAdd varchar(100) NOT NULL,
    dSuburb varchar(50) NOT NULL,
    dState varchar(50) NOT NULL,
    PRIMARY KEY (requestID),
    FOREIGN KEY (custID) REFERENCES customer(CustID))

I keep getting errors saying that there is an error near the first statement. I can't seem to figure out what is actually wrong. Am I missing something really obvious or??


Solution

  • The issue was that there was white space after the open bracket eg. CREATE TABLE customer ("white space"...

    Once I deleted the white space everything worked