Check out example codes for "create table mysql with foreign key". It will help you in understanding the concepts better.

Code Example 1

ALTER TABLE table_name
DROP CONSTRAINT fk_name;

Code Example 2

ALTER TABLE Orders
ADD FOREIGN KEY (PersonID) REFERENCES Persons(PersonID);

Code Example 3

CREATE TABLE Orders (
    OrderID int NOT NULL,
    OrderNumber int NOT NULL,
    PersonID int,
    PRIMARY KEY (OrderID),
    FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
);

Code Example 4

ALTER TABLE Orders

ADD CONSTRAINT FK_PersonOrder

FOREIGN KEY (PersonID)
REFERENCES Persons(PersonID);

Learn ReactJs, React Native from akashmittal.com