CREATE TABLE
using constraints.
CREATE TABLE Employee (
ID INT PRIMARY KEY,
Name VARCHAR(255),
DepartmentName VARCHAR(40),
Salary INT
);
Employee
:
CREATE TABLE Employee (
ID INT PRIMARY KEY,
Name VARCHAR(255) NOT NULL,
DepartmentCode INT,
Salary INT,
CONSTRAINT FK_Department FOREIGN KEY (DepartmentCode) REFERENCES Department(DepartmentCode)
);
This presentation enhances the understanding of key constraints in SQL used to maintain database integrity and relationships.