Professional Documents
Culture Documents
FINAL EXAM
SECTION: A
DATE: 03-06-2021
Query no :1
select * from Employees where first_name like 'S%'
Query no :2
select* from Employees where DATEDIFF(year, hire_date, GetDate()) >= 6
Query no :3
select E.First_Name + ' ' + E.Last_Name AS [EmployeeName],COUNT(JH.Employee_id)
[Promotion Count] from Employees E
GROUP BY JH.Employee_id,E.First_Name,E.Last_Name
Query no :4
CREATE VIEW [dbo].[vMissingManagers]
AS
GO
Query no :5
select E.first_name +' '+ E.last_name AS [ManagerName], D.Department_Name from
DEPARTMENTS D
Query no :6
Delete E from Employees E
Query no :7
select salary, salary+(salary*0.1) as [new salary] from employees
Query no :8
select E.first_name +' '+ E.last_name AS [EmployeeName], D.Department_Name from
DEPARTMENTS D
Query no :9
SELECT YEAR(HIRE_DATE) AS [YEAR],J.JOB_TITLE AS [DESIGNATION],COUNT(J.JOB_TITLE)
AS[COUNT] FROM EMPLOYEES E
GROUP BY YEAR(HIRE_DATE),J.JOB_TITLE
Query no :10
CREATE PROCEDURE prEmployeesAdd
AS
BEGIN
([employee_id]
,[first_name]
,[last_name]
,[email]
,[phone_number]
,[hire_date]
,[job_id]
,[salary]
Muhammad Zaryab Malik DBMS(LAB) 142-BSCS-19(A)
,[commission_pct]
,[manager_id]
,[department_id])
VALUES
(@employee_id,
@first_name,
@last_name,
@email,
@phone_number,
@hire_date,
@job_id,
@salary,
@commission_pct,
@manager_id,
@department_id)
END
Question 11:
Muhammad Zaryab Malik DBMS(LAB) 142-BSCS-19(A)
PartA:
Part B:
Muhammad Zaryab Malik DBMS(LAB) 142-BSCS-19(A)
( employee_id NUMERIC(6)
, certification_id NUMERIC(6)
, certification_title VARCHAR(100)
, start_dat DATE
, completion_date DATE
);
Part C:
ALTER TABLE certifications
Part D:
ALTER TABLE certifications
, CONSTRAINT jcert_emp_fk
REFERENCES employees