Answers for "add foreign key sql server query"

SQL
2

sql foreign key

CREATE TABLE orders (
id int NOT NULL,
user_id int,
product_id int,
PRIMARY KEY (id),
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (product_id) REFERENCES products(id)
);
Posted by: Guest on January-07-2021
1

sql foreign key

create table Jobs(
job_id number not null,
job_title varchar(30),
min_salary number,
max_salary number
);
create table job_history(
employee_id number not null,
start_date date,
end_date date,
job_id number not null,
department_id number
);
alter table jobs add constraint pk_jobs primary key(job_id);
alter table job_history add constraint fk_job foreign key(job_id) references jobs(job_id);
Posted by: Guest on September-20-2021

Code answers related to "add foreign key sql server query"

Code answers related to "SQL"

Browse Popular Code Answers by Language