-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab-3.sql
More file actions
39 lines (32 loc) · 764 Bytes
/
Copy pathLab-3.sql
File metadata and controls
39 lines (32 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- IF ELSE --
SELECT* FROM Employees
DECLARE @A VARCHAR(35)
SELECT @A = Department
FROM EMPLOYEES WHERE E_ID = 'E011'
if @A = 'IT'
PRINT 'He is from same department'
else
PRINT 'He is from different department'
if(SELECT MAX(Salary) FROM Employees) < 60000
BEGIN
PRINT 'Salary is not enough'
END
else
BEGIN
if(SELECT MAX(Salary) FROM Employees) < 9000
BEGIN
UPDATE Employees SET Salary = Salary + Salary *.5
END
else
BEGIN
PRINT'Salary is more than enough'
END
END
--Find employee salary--
--If average selery > 60 update salary 15% decryment--
--Loop MAX salary < 60--
DECLARE @i int = (SELECT AVG(Salary) FROM Employees)
WHILE @i > 40000
UPDATE Employees SET Salary = Salary - Salary *.5
if(SELECT MAX(Salary) FROM Employees) < 60000
BREAK