LAB TASK 5 WORD
LAB TASK 5 WORD
LAB TASK 5 WORD
EMAAN IMRAN
247055
A). Apply PK, FK and Not Null constraints in the Employee and
Copied code:
GO
USE COMPANY;
-- Create Employee table with PK, FK, and NOT NULL constraints
MiddleInitial CHAR(1),
);
GO
-- Create Department table with PK and NOT NULL constraints
);
GO
('John', 'B', 'Smith', '123456789', '1955-01-09', '731 Fondren, Houston, TX', 'M', 30000,
'987654321', 5),
('Franklin', 'T', 'Wong', '333445555', '1945-12-08', '638 Voss, Houston, TX', 'M', 40000,
'888665555', 5),
('Joyce', 'A', 'English', '453453453', '1962-07-31', '5631 Rice, Houston, TX', 'F', 25000,
'333445555', 5),
('Ramesh', 'K', 'Narayan', '666884444', '1952-09-15', '975 Fire Oak, Humble, TX', 'M', 38000,
'333445555', 5),
('James', 'E', 'Borg', '888665555', '1927-11-10', '450 Stone, Houston, TX', 'M', 55000, NULL, 1),
('Jennifer', 'S', 'Wallace', '987654321', '1931-06-20', '291 Berry, Bellaire, TX', 'F', 43000,
'888665555', 4),
('Ahmad', 'V', 'Jabbar', '987987987', '1959-03-29', '980 Dallas, Houston, TX', 'M', 25000,
'987654321', 4),
('Alicia', 'J', 'Zelaya', '999887777', '1958-07-19', '3321 Castle, Spring, TX', 'F', 25000,
'987654321', 4);
GO
VALUES
GO
FK)
Department.DepartmentNumber
GO
$40,000.
SELECT *
FROM Employee
WHERE DepartmentNumber = 5
FROM Employee E
--For each employee, retrieve the employee’s first and last name and the first and last
FROM Employee E
--Retrieve the name and address of all employees who work for the ‘Research’
department.
FROM Employee E
Screenshot:
RESULT:
1.
2.
3.
4.
5.