I am creating two tables called customer and item. For the customer table customerID is the primary key and for the item table itemID is the primary key. And I am creating another table which is myOrder. In myOrdertable customerID and itemID are a compound key. I defined both the columns as foreign keys as well. Once I finish creating the tables the compound key shows fine but cutomerID does not get displayed as a foreign key like in the screen capture. [![enter image description here][1]][1]
Below is the code I used.
CREATE DATABASE FK_TEST;
USE FK_TEST;
CREATE TABLE Customer
(
customerID VARCHAR(10) NOT NULL,
name VARCHAR(25),
PRIMARY KEY(customerID)
);
CREATE TABLE ITEM
(
itemID VARCHAR(10) NOT NULL,
itemName VARCHAR(10),
PRIMARY KEY(itemID)
);
CREATE TABLE myOrder
(
customerID VARCHAR(10) NOT NULL,
itemID VARCHAR(10) NOT NULL,
qty FLOAT(5,2),
PRIMARY KEY(customerID,itemID),
FOREIGN KEY(customerID) REFERENCES Customer(customerID),
FOREIGN KEY(itemID) REFERENCES ITEM(itemID)
);