This repository has been archived by the owner on Mar 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ISTAPRO07-NEW.sql
143 lines (122 loc) · 3.47 KB
/
ISTAPRO07-NEW.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
-- Name: Jacob Duenke
-- File: ISTAPRO07
-- Date: March 18, 2019
use [ISTAPRO07-B];
drop table if exists Users;
create table Users
(
UserID int identity primary key
,UserName varchar(20)
,Email varchar(30)
,TicketNumber int
);
insert into Users
output
inserted.UserName
,inserted.Email
,inserted.TicketNumber
values
('Dinks','[email protected]',1000)
,('K-Pop','[email protected]',1123)
,('ThaMich','[email protected]',1246)
,('ChiTea','[email protected]',1369)
,('Chuckles','[email protected]',1492);
select * from Users;
drop table if exists Employees;
create table Employees
(
EmpID int identity primary key
,EmpName varchar(20)
,TicketNumber int
);
insert into Employees
output
inserted.EmpName
,inserted.TicketNumber
values
('ThatGuy',1001)
,('Robert',1340)
,('Michael',1904)
,('Tom',3123)
,('Craig',9999);
select * from Employees;
drop table if exists NewTickets;
create table NewTickets
(
TicketNumber int identity(1000,123) primary key
,SubmitDate date
,UserID int
,Platform varchar(20)
,Issue varchar(max)
);
insert into NewTickets
output
inserted.SubmitDate
,inserted.UserID
,inserted.Platform
,inserted.Issue
values
('2019-02-12',1,'Mac OS','I cannot install Windows 10 for some reason.')
,('2019-02-24',2,'Windows 10','Need help turning computer on.')
,('2019-03-01',3,'Windows 10','My computer thinks there are only 28 days in February.')
,('2019-03-05',4,'Mac OS','Can a Mac play games?')
,('2019-03-17',5,'Windows Phone','My phone will not respond unless I wear green today.')
select * from NewTickets;
drop table if exists OpenTickets;
create table OpenTickets
(
TicketNumber int
,SubmitDate date
,OpenDate date
,EmpID int
,UserID int
,Platform varchar(20)
,Issue varchar(max)
);
insert into OpenTickets
output
inserted.TicketNumber
,inserted.SubmitDate
,inserted.OpenDate
,inserted.EmpID
,inserted.UserID
,inserted.Platform
,inserted.Issue
values
(1000,'2019-02-12','2019-02-13',2,1,'Mac OS','I cannot install Windows 10 for some reason.')
,(1123,'2019-02-24','2019-02-25',3,2,'Windows 10','Need help turning computer on.')
,(1246,'2019-03-01','2019-03-02',4,3,'Windows 10','My computer thinks there are only 28 days in February.')
,(1369,'2019-03-05','2019-03-06',5,4,'Mac OS','Can a Mac play games?')
,(1492,'2019-03-17','2019-03-18',1,5,'Windows Phone','My phone will not respond unless I wear green today.')
select * from OpenTickets;
drop table if exists CompletedTickets;
create table CompletedTickets
(
TicketNumber int
,SubmitDate date
,OpenDate date
,CloseDate date
,EmpID int
,UserID int
,Platform varchar(20)
,Issue varchar(max)
,Resolution varchar(max)
);
insert into CompletedTickets
output
inserted.TicketNumber
,inserted.SubmitDate
,inserted.OpenDate
,inserted.CloseDate
,inserted.EmpID
,inserted.UserID
,inserted.Platform
,inserted.Issue
,inserted.Resolution
values
(1000,'2019-02-12','2019-02-13','2019-02-14',2,1,'Mac OS','I cannot install Windows 10 for some reason.','ID10T ERROR')
,(1123,'2019-02-24','2019-02-25','2019-02-26',3,2,'Windows 10','Need help turning computer on.','ID10T ERROR')
,(1246,'2019-03-01','2019-03-02','2019-03-03',4,3,'Windows 10','My computer thinks there are only 28 days in February.','ID10T ERROR')
,(1369,'2019-03-05','2019-03-06','2019-03-07',5,4,'Mac OS','Can a Mac play games?','ID10T ERROR')
,(1492,'2019-03-17','2019-03-18','2019-03-19',1,5,'Windows Phone','My phone will not respond unless I wear green today.','ID10T ERROR')
select * from CompletedTickets;