so I've been practising my SQL and came upon a book which contains this code inside. It actually had an 'ON DELETE RESTRICT ON UPDATE CASCADE' command at the end but I removed it (because apparently you hand to use the 'relation view' in phpMyAdmin to do it) and tried executing my slightly altered code.

Now, although I am not extremely good at SQL, I can at least tell if my CREATE TABLE statement is correct. However, when I ran it, I kept running into 'an opening bracket was expected near ) )' and 'a closing bracket was expected near ) )'.

Which Server am I using: The free one on 'remotemysql.com' Port: 3306

CREATE TABLE product (
  P_code char(10) NOT NULL UNIQUE,
  P_descript varchar(35) NOT NULL,
  P_indate date NOT NULL,
  P_onhand SMALLINT NOT NULL,
  P_min SMALLINT NOT NULL,
  P_price decimal(8, 2) NOT NULL,
  P_discount decimal(4, 2) NOT NULL,
  PRIMARY KEY(P_code),
  FOREIGN KEY(V_code) REFERENCES vendor 
);

Error:

An opening bracket was expected. (near ")" at position 354) A closing bracket was expected. (near ")" at position 354)

I expect the table to be created, but well, this happens.

I thank you for your assistance in advance.

0 Answers