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

Code Example 1

CREATE TABLE IF NOT EXISTS `scores` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  UserId int(11) NOT NULL,
  `NICKNAME` varchar(50) NOT NULL,
  `HIGHSCORE` int(11) NOT NULL,
  PRIMARY KEY (`ID`),
  FOREIGN KEY (UserId) REFERENCES USER(Id)
);

Learn ReactJs, React Native from akashmittal.com