//Для MySQL:
CREATE TABLE table_1 (
ID_1 int NOT NULL
ID_2 int
PRIMARY KEY (ID_1)
FOREIGN KEY (ID_2) REFERENCES table_2(ID_2));
//Для MS SQL Server, Oracle, MS Access:
CREATE TABLE table_1 (
ID_1 int NOT NULL PRIMARY KEY
ID_2 int FOREIGN KEY REFERENCES table_2(ID_2));
//Для MySQL:
CREATE TABLE Authors (
Author_ID int NOT NULL,
AuthorName varchar(50),
PRIMARY KEY(Author_ID));
CREATE TABLE Books (
Book_ID int NOT NULL,
BookName varchar(100),
FOREIGN KEY (Book_ID) REFERENCES Authors(Author_ID));
// для MS SQL Server:
CREATE TABLE Authors (
AuthorID int NOT NULL PRIMARY KEY,
AuthorName varchar(50));
CREATE TABLE Books (
Book_ID int FOREIGN KEY REFERENCES Authors(Author_ID),
BookName varchar(100));