Experiment 04
Aim
To study and implement various data constraints in SQL
Theory
note
Write the following from the links provided:
Commands
CREATE TABLE Departments (
DepartmentID INT PRIMARY KEY,
DepartmentName VARCHAR(50) NOT NULL UNIQUE
);
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
Email VARCHAR(100) UNIQUE,
Age INT CHECK (Age >= 18),
DepartmentID INT,
Salary DECIMAL(10, 2) DEFAULT 30000.00,
FOREIGN KEY (DepartmentID) REFERENCES Departments(DepartmentID)
);
DESCRIBE Employees;
Table
Draw the table that the following script will give as output(on the left-hand side of the record)
DESCRIBE Employees;
Conclusion
Successfully studied and implemented SQL data constraints