-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZipkin cap2.txt
174 lines (123 loc) · 4.77 KB
/
Zipkin cap2.txt
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
—Joshua Zipkin
DROP TABLE IF EXISTS orders;
DROP TABLE IF EXISTS customers;
DROP TABLE IF EXISTS agents;
DROP TABLE IF EXISTS products;
-- Customers --
CREATE TABLE customers (
cid char(4) not null,
name text,
city text,
discount decimal(5,2),
primary key(cid)
);
-- Agents --
CREATE TABLE agents (
aid char(3) not null,
name text,
city text,
percent real,
primary key(aid)
);
-- Products --
CREATE TABLE products (
pid char(3) not null,
name text,
city text,
quantity integer,
priceUSD numeric(10,2),
primary key(pid)
);
-- Orders --
CREATE TABLE orders (
ordno integer not null,
mon char(3),
cid char(4) not null references customers(cid),
aid char(3) not null references agents(aid),
pid char(3) not null references products(pid),
qty integer,
dollars numeric(12,2),
primary key(ordno)
);
-- Customers --
INSERT INTO Customers( cid, name, city, discount )
VALUES('c001', 'Tiptop', 'Duluth', 10.00);
INSERT INTO Customers( cid, name, city, discount )
VALUES('c002', 'Basics', 'Dallas', 12.00);
INSERT INTO Customers( cid, name, city, discount )
VALUES('c003', 'Allied', 'Dallas', 8.00);
INSERT INTO Customers( cid, name, city, discount )
VALUES('c004' ,'ACME' ,'Duluth', 8.00);
INSERT INTO Customers( cid, name, city, discount )
VALUES('c005' ,'Weyland-Yutani', 'Acheron', 0.00);
INSERT INTO Customers( cid, name, city, discount )
VALUES('c006' ,'ACME' ,'Kyoto' ,0.00);
-- Agents --
INSERT INTO Agents( aid, name, city, percent )
VALUES('a01', 'Smith', 'New York', 6 );
INSERT INTO Agents( aid, name, city, percent )
VALUES('a02', 'Jones', 'Newark', 6 );
INSERT INTO Agents( aid, name, city, percent )
VALUES('a03', 'Brown', 'Tokyo', 7 );
INSERT INTO Agents( aid, name, city, percent )
VALUES('a04', 'Gray', 'New York' ,6 );
INSERT INTO Agents( aid, name, city, percent )
VALUES('a05', 'Otasi', 'Duluth', 5 );
INSERT INTO Agents( aid, name, city, percent )
VALUES('a06', 'Smith', 'Dallas', 5 );
INSERT INTO Agents( aid, name, city, percent )
VALUES('a08', 'Bond', 'London', 7 );
-- Products --
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p01', 'comb', 'Dallas', 111400, 0.50 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p02', 'brush', 'Newark', 203000, 0.50 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p03', 'razor', 'Duluth', 150600, 1.00 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p04', 'pen', 'Duluth', 125300, 1.00 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p05', 'pencil', 'Dallas', 221400, 1.00 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p06', 'folder','Dallas', 123100, 2.00 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p07', 'case', 'Newark', 100500, 1.00 );
INSERT INTO Products( pid, name, city, quantity, priceUSD )
VALUES('p08', 'clip', 'Newark', 200600, 1.25 );
-- Orders --
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1011, 'jan', 'c001', 'a01', 'p01', 1000, 450.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1013, 'jan', 'c002', 'a03', 'p03', 1000, 880.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1015, 'jan', 'c003', 'a03', 'p05', 1200, 1104.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1016, 'jan', 'c006', 'a01', 'p01', 1000, 500.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1017, 'feb', 'c001', 'a06', 'p03', 600, 540.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1018, 'feb', 'c001', 'a03', 'p04', 600, 540.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1019, 'feb', 'c001', 'a02', 'p02', 400, 180.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1020, 'feb', 'c006', 'a03', 'p07', 600, 600.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1021, 'feb', 'c004', 'a06', 'p01', 1000, 460.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1022, 'mar', 'c001', 'a05', 'p06', 400, 720.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1023, 'mar', 'c001', 'a04', 'p05', 500, 450.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1024, 'mar', 'c006', 'a06', 'p01', 800, 400.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1025, 'apr', 'c001', 'a05', 'p07', 800, 720.00);
INSERT INTO Orders( ordno, mon, cid, aid, pid, qty, dollars )
VALUES(1026, 'may', 'c002', 'a05', 'p03', 800, 740.00);
select *
from customers;
select *
from agents;
select *
from products;
select *
from orders;