Sorry, I'm really a newbie at this mysql stuff. So I tried to create a table called orders with the CustomerID as a foreign key. When I try to create the table I got this message:
ERROR 1072 <42000> at line 7: Key column 'CustomerID' doesn't exist in table
CREATE TABLE Orders
(
OrderID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
Date varchar(8) NOT NULL,
Time varchar(4) NOT NULL,
SalesAmount varchar(4) NOT NULL,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
) ;
I'm not sure what's wrong but does it have to do with "constraint"?
Thanks in advance for any help!
ERROR 1072 <42000> at line 7: Key column 'CustomerID' doesn't exist in table
CREATE TABLE Orders
(
OrderID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
Date varchar(8) NOT NULL,
Time varchar(4) NOT NULL,
SalesAmount varchar(4) NOT NULL,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
) ;
I'm not sure what's wrong but does it have to do with "constraint"?
Thanks in advance for any help!