-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL07Lab.sql
More file actions
181 lines (151 loc) · 3.36 KB
/
SQL07Lab.sql
File metadata and controls
181 lines (151 loc) · 3.36 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
--Jose Guadarrama
--10/21/2014
--1
Insert Into Guadarrama.Customer
Values(11031,
'Wilmington University',
'1011 North DuPont Hwy.',
'Wilmington',
'DE',
'19896-1011',
.200,
100000,
0.00);
--2
Insert Into Guadarrama.Customer
Values(11032,
'Cyber Experts',
'15 The Circle',
'Dover',
'DE',
'19901-0015',
.095,
22500,
0.00);
--3
Insert Into Guadarrama.SalesRep
Values(99012,
'Warren',
'T',
'Wells',
'M',
'1983-03-19',
'2010-11-01',
33,
10.00,
.040);
--4
Insert Into Guadarrama.SalesRep
Values(99013,
'Stephanie',
'K',
'Clarkson',
'F',
'1984-02-14',
'2010-11-15',
44,
11.25,
.075);
--5
Update Guadarrama.Customer
Set CustName = Replace(CustName,
'Co.',
'Company');
--6
Update Guadarrama.Customer
Set CustName = Replace(CustName,
'Inc.',
'Incorporation');
--7
Update Guadarrama.Customer
Set CustName = Replace(CustName,
'Corp.',
'Corporation');
--8
Update Guadarrama.Customer
Set Address = Replace(Address,
'St.',
'Street');
--9
Update Guadarrama.Customer
Set Address = Replace(Address,
'Ave.',
'Avenue');
--10
Update Guadarrama.Customer
Set Address = Replace(Address,
'Blvd.',
'Boulevard');
--11
Update Guadarrama.Customer
Set Address = Replace(Address,
'Rd.',
'Road');
--12
Update Guadarrama.Customer
Set Address = Replace(Address,
'Hwy.',
'Highway');
--13
Update Guadarrama.Customer
Set Address = Trim(Address) Concat' / Suite A'
Where CustNo = 11018;
--14
Update Guadarrama.SalesRep
Set LastName ='Whitmore'
Where SalesRepNo = 99002;
--15
Update Guadarrama.Customer
Set Discount = Discount - (.015 * Discount)
Where Discount < .100;
--16
Update Guadarrama.Customer
Set Discount = (Select Avg(Discount)
From Guadarrama.Customer)
Where CustNo = 11032;
--17
Update Guadarrama.Customer
Set Discount = Discount + (.025 * Discount)
Where CustName in ('Delaware-Tech','University of Delaware','Delaware State University','Wilmington University');
--18
Update Guadarrama.SalesRep
Set PayRate = PayRate + (.035 * PayRate);
--19
Update Guadarrama.Customer
Set CreditLmt = CreditLmt - 3500
Where Balance > 0;
--20
Update Guadarrama.SalesTrans
Set ShipDate = SaleDate + 3 Days
Where SaleDate Between '2013-12-01' And '2013-12-31';
--21
Update Guadarrama.Department
Set DeptName = Trim(DeptName) Concat' & Components'
Where DeptNo = 11;
--22
Update Guadarrama.Department
Set DeptName = Trim(DeptName) Concat' & Contracts'
Where DeptNo = 66;
--23
Update Guadarrama.Customer
Set City = 'Cumberland',
ZipCode = '21501-0001'
Where CustNo = 11021;
--24
Update Guadarrama.SalesRep
Set CommRate = CommRate + (.005 + CommRate);
--25
Delete From Guadarrama.Department
Where DeptNo = 77;
--26
Delete From Guadarrama.SalesTrans
Where ShipDate >= '2013-12-25';
--27
Select * From Guadarrama.Customer;
--28
Select * From Guadarrama.SalesRep;
--29
Select * From Guadarrama.SalesTrans
Where SaleDate Between '2013-12-01' And '2013-12-31';
--30
Select * From Guadarrama.Department;