Created
January 24, 2019 14:38
-
-
Save Nikaoto/651a94e90b30ce1d8cdebefd26798d40 to your computer and use it in GitHub Desktop.
MariaDB foreign key example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table certificates ( | |
user_row_id int not null unique, | |
first_name varchar(40) not null, | |
last_name varchar(50) not null, | |
email varchar(50) not null, | |
birth_date date not null, | |
test_datetime datetime not null, | |
CONSTRAINT `fk_user_row_id` -- create fk constraint | |
foreign key (user_row_id) references users (id) -- define constraint | |
on update restrict -- define when the restriction should apply | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment