Sintaxe incorreta perto de 'AUTO_INCREMENT'

Sintaxe incorreta perto de 'AUTO_INCREMENT'

Recebo um erro em AUTO_INCREMENT ao criar a tabela a seguir. Por favor ajude.

CREATE TABLE Invoice( 
Invoice_No INT NOT NULL AUTO_INCREMENT, 
Order_ID INT NOT NULL, 
TotalPrice VARCHAR(30) NOT NULL, 
Quantity VARCHAR(30) NOT NULL, 
PRIMARY KEY (Invoice No), 
FOREIGN KEY (Order_ID) REFERENCES OrderInfo (Order_ID) );

Responder1

  1. Certifique-se de usar o MySQL, pois AUTO_INCREMENT não funciona para outros bancos de dados, como o SQL Server (use- Identity(1, 1)o com ele).

  2. Use Invoice_Noe não Invoice Noao marcá-lo como PK.

informação relacionada