
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
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).Use
Invoice_No
e nãoInvoice No
ao marcá-lo como PK.