-
Notifications
You must be signed in to change notification settings - Fork 0
/
Updates.sql
58 lines (44 loc) · 1.39 KB
/
Updates.sql
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- Update hour modifier given an ambassador and position
UPDATE Participated
SET hour_modifier = {hourModifier}
WHERE position_ID = {positionID}
AND UIN = {UIN};
UPDATE Participated
SET hour_modifier = {hourModifier}
WHERE position_ID = {positionID}
AND EXISTS (SELECT 1
FROM Ambassador
WHERE Ambassador.UIN = Participated.UIN
AND first_name = {firstName}
AND last_name = {lastName});
-- Update name for a given ambassador
UPDATE Ambassador
SET first_name = {firstName},last_name ={lastName},
WHERE UIN = {UIN};
-- Update major for a given ambassador
UPDATE Ambassador
SET major = {givenMajor}
WHERE first_name = {firstName}
AND last_name = {lastName};
UPDATE Ambassador
SET major = {givenMajor}
WHERE UIN = {UIN};
-- Update ambassador status for a given ambassador
UPDATE Ambassador
SET is_ambassador = {givenStatus}
WHERE first_name = {firstName}
AND last_name = {lastName}
AND UIN = {UIN};
-- Update graduation year for a given ambassador
UPDATE Ambassador
SET grad_year = {givenYear}
WHERE first_name = {firstName}
AND last_name = {lastName};
UPDATE Ambassador
SET grad_year = {givenYear}
WHERE UIN = {UIN};
-- Update scheduled hours for a given position
UPDATE Position
SET base_hours = {positionHours}
WHERE position_ID = {positionID}
AND event_ID = {eventID};