“Kunci Asing SQL” Kode Jawaban

cara menambahkan kendala kunci asing di SQL

ALTER TABLE 'table_name'
ADD CONSTRAINT 'constraint_name' FOREIGN KEY 'foreign_key' REFERENCES 'column_name'('primary_key');
Lux

ubah tabel tambahkan kolom dan kunci asing mysql

ALTER TABLE database.table
  ADD COLUMN columnname INT DEFAULT(1),
  ADD FOREIGN KEY fk_name(fk_column) REFERENCES reftable(refcolumn) ON DELETE CASCADE;
Open Owl

Kunci Asing SQL

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);
Fierce Ferret

kunci asing

USE Organization
CREATE TABLE Employee_Office
(
Id INT PRIMARY KEY IDENTITY(1,1),
Emp_Id int FOREIGN KEY REFERENCES Employee(Id),
Office_Id int FOREIGN KEY REFERENCES Office(Id)
)
Adorable Armadillo

SQL Kendala Kunci Asing

CREATE TABLE Orders (
  order_id INT PRIMARY KEY,
  customer_id int REFERENCES Customers(id)
);
SAMER SAEID

kunci asing

USE Organization
CREATE TABLE Employee
(
Id INT PRIMARY KEY IDENTITY(1,1),
Name VARCHAR (50) NOT NULL,
Age INT,
Gender VARCHAR (50),
Dep_Id int FOREIGN KEY REFERENCES Department(Id),
Insur_Id int FOREIGN KEY REFERENCES Insurance(Id)
)
Adorable Armadillo

Jawaban yang mirip dengan “Kunci Asing SQL”

Pertanyaan yang mirip dengan “Kunci Asing SQL”

Lebih banyak jawaban terkait untuk “Kunci Asing SQL” di Sql

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya