-
Notifications
You must be signed in to change notification settings - Fork 0
/
Challa_MeghnathReddy_IP_Task5a.sql
279 lines (242 loc) · 5.74 KB
/
Challa_MeghnathReddy_IP_Task5a.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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
----------QUERIES----------------
--To add a Person
DROP PROCEDURE IF EXISTS insertintoPerson
GO
CREATE PROCEDURE insertintoPerson
--Parameters to be taken as input are declared
@SNN INT ,@Name VARCHAR(30) ,
@Birthdate DATE,
@Race VARCHAR(20) ,@Gender VARCHAR(10),
@Profession VARCHAR(20) ,
@Mail_address Varchar(100),@Email_address Varchar(30),@Home_phone INT,
@Work_phone INT,@Cell_phone INT,@Mailing_list INT
AS
BEGIN
INSERT INTO Person VALUES(@SNN,@Name,@Birthdate,@Race,
@Gender,@Profession,@Mail_address,@Email_address,@Home_phone,@Work_phone,@Cell_phone,@Mailing_list);
END
GO
--FOR OPTION-1
DROP PROCEDURE IF EXISTS insertintoTeam
GO
CREATE PROCEDURE insertintoTeam
--Parameters to be taken as input are declared
@T_Name VARCHAR(30) ,
@Type VARCHAR(20) ,
@Date_T INT
AS
BEGIN
INSERT INTO Teams VALUES(@T_Name,@Type,@Date_T);
END
GO
--FOR OPTION-2
DROP PROCEDURE IF EXISTS insertintoClient
GO
CREATE PROCEDURE insertintoClient
--Parameters to be taken as input are declared
@SSN INT,
@Doctor_Name VARCHAR(30) ,
@Attor_Name VARCHAR(30) ,
@Doctor_phone INT ,
@Attor_phone INT ,
@Date_assigned DATE
AS
BEGIN
INSERT INTO Client VALUES(@SSN,@Doctor_Name,@Attor_Name,@Doctor_phone,@Attor_phone,@Date_assigned);
END
GO
DROP PROCEDURE IF EXISTS insertintoCare
GO
CREATE PROCEDURE insertintoCare
--Parameters to be taken as input are declared
@SSN INT,
@T_Name VARCHAR(30),
@C_ActiveState INT
AS
BEGIN
INSERT INTO Cares VALUES(@SSN,@T_Name,@C_ActiveState);
END
GO
---For option 3
DROP PROCEDURE IF EXISTS insertintoVolunteer
GO
CREATE PROCEDURE insertintoVolunteer
--Parameters to be taken as input are declared
@SSN INT,
@Joining_Date DATE,
@Training_Date DATE,
@Training_Loc Varchar(30)
AS
BEGIN
INSERT INTO Volunteers VALUES(@SSN,@Joining_Date,@Training_Date,@Training_Loc);
END
GO
---For option 3,4
DROP PROCEDURE IF EXISTS insertintoServes
GO
CREATE PROCEDURE insertintoServes
--Parameters to be taken as input are declared
@SSN INT,
@T_Name VARCHAR(30),
@Hours INT,
@ActiveState INT,
@Specific_Month Varchar(20)
AS
BEGIN
INSERT INTO Serves VALUES(@SSN,@T_Name,@Hours,@ActiveState,@Specific_Month);
END
GO
---For option 5
DROP PROCEDURE IF EXISTS insertintoEmployee
GO
CREATE PROCEDURE insertintoEmployee
--Parameters to be taken as input are declared
@SSN INT,
@Salary FLOAT,
@M_Status VARCHAR(20),
@Hire_Date DATE
AS
BEGIN
INSERT INTO Employees VALUES(@SSN,@Salary,@M_Status,@Hire_Date);
END
GO
DROP PROCEDURE IF EXISTS insertintoReports
GO
CREATE PROCEDURE insertintoReports
--Parameters to be taken as input are declared
@SSN INT,
@T_Name VARCHAR(30),
@R_DATE DATE,
@Desc_1 VARCHAR(30)
AS
BEGIN
INSERT INTO Reports VALUES(@SSN,@T_Name,@R_DATE,@Desc_1);
END
GO
---For option 6
DROP PROCEDURE IF EXISTS insertintoExpense
GO
CREATE PROCEDURE insertintoExpense
--Parameters to be taken as input are declared
@SSN INT,
@Amount FLOAT,
@Desc_1 VARCHAR(30),
@Expense_Date INT
AS
BEGIN
INSERT INTO Expenses VALUES(@SSN,@Amount,@Desc_1,@Expense_Date);
END
GO
---For option 7
DROP PROCEDURE IF EXISTS insertintoExternal_Org
GO
CREATE PROCEDURE insertintoExternal_Org
--Parameters to be taken as input are declared
@Org_Name Varchar (20),
@Org_address Varchar (30),
@Org_Number INT,
@Org_Contact Varchar(20)
AS
BEGIN
INSERT INTO External_Org VALUES(@Org_Name,@Org_address,@Org_Number,@Org_Contact);
END
GO
DROP PROCEDURE IF EXISTS insertintoSponsors
GO
CREATE PROCEDURE insertintoSponsors
--Parameters to be taken as input are declared
@T_Name VARCHAR(30),
@Org_Name VARCHAR(20)
AS
BEGIN
INSERT INTO Sponsors VALUES(@T_Name,@Org_Name);
END
GO
---For option 8
DROP PROCEDURE IF EXISTS insertintoDonor
GO
CREATE PROCEDURE insertintoDonor
--Parameters to be taken as input are declared
@SSN INT,
@Anonymous VARCHAR(30)
AS
BEGIN
INSERT INTO Donors VALUES(@SSN,@Anonymous);
END
GO
DROP PROCEDURE IF EXISTS insertintoCheck
GO
CREATE PROCEDURE insertintoCheck
--Parameters to be taken as input are declared
@SSN INT,
@Date DATE,
@DAmount FLOAT,
@DTYPE VARCHAR(30),
@CampaignName VARCHAR(30),
@ChequeNumber INT
AS
BEGIN
INSERT INTO Check_1 VALUES(@SSN,@Date,@DAmount,@DTYPE,@CampaignName,@ChequeNumber);
END
GO
DROP PROCEDURE IF EXISTS insertintoCredit
GO
CREATE PROCEDURE insertintoCredit
--Parameters to be taken as input are declared
@SSN INT,
@Date DATE,
@DAmount FLOAT,
@DTYPE VARCHAR(30),
@CampaignName VARCHAR(30),
@CardNumber INT,
@CardType VARCHAR(20),
@ExpDate DATE
AS
BEGIN
INSERT INTO Credit_Card VALUES(@SSN,@Date,@DAmount,@DTYPE,@CampaignName,@CardNumber,@CardType,@ExpDate);
END
GO
----For option 9
DROP PROCEDURE IF EXISTS insertintoExternalDonor
GO
CREATE PROCEDURE insertintoExternalDonor
--Parameters to be taken as input are declared
@Org_Name VARCHAR(20),
@Anonymous VARCHAR(20)
AS
BEGIN
INSERT INTO External_Donor VALUES(@Org_Name,@Anonymous);
END
GO
DROP PROCEDURE IF EXISTS insertintoExCheck
GO
CREATE PROCEDURE insertintoExCheck
--Parameters to be taken as input are declared
@Org_Name Varchar (20),
@Date DATE,
@DAmount FLOAT,
@DTYPE VARCHAR(30),
@CampaignName VARCHAR(30),
@ChequeNumber INT
AS
BEGIN
INSERT INTO Ex_check VALUES(@Org_Name,@Date,@DAmount,@DTYPE,@CampaignName,@ChequeNumber);
END
GO
DROP PROCEDURE IF EXISTS insertintoExCredit
GO
CREATE PROCEDURE insertintoExCredit
--Parameters to be taken as input are declared
@Org_Name Varchar (20),
@Date DATE,
@DAmount FLOAT,
@DTYPE VARCHAR(30),
@CampaignName VARCHAR(30),
@CardNumber INT,
@CardType VARCHAR(20),
@ExpDate DATE
AS
BEGIN
INSERT INTO Ex_creditcard VALUES(@Org_Name,@Date,@DAmount,@DTYPE,@CampaignName,@CardNumber,@CardType,@ExpDate);
END
GO