“иностранный ключ” Ответ

Laravel Foreign Key

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});
Courageous Cod

Отбросьте иностранный ключ

ALTER TABLE table_name
DROP CONSTRAINT fk_name;
SmokeFrog

иностранный ключ

An index on a table is a data structure that makes random access to the rows 
fast and efficient. It helps to optimize the internal organization of a table 
as well.

A foreign key is simply a pointer to a corresponding column in another table 
that forms a referential constraint between the two tables.
calyCoder

иностранный ключ

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

иностранный ключ

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

иностранный ключ

ALTER TABLE your_table ADD FOREIGN KEY (your_column) REFERENCES other_table(other_column);
Healthy Hare

Ответы похожие на “иностранный ключ”

Вопросы похожие на “иностранный ключ”

Больше похожих ответов на “иностранный ключ” по Sql

Смотреть популярные ответы по языку

Смотреть другие языки программирования