-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathorder.sql
More file actions
300 lines (237 loc) · 14.9 KB
/
order.sql
File metadata and controls
300 lines (237 loc) · 14.9 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
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
select * from tblmember;
select * from tblAuth;
select * from tblcoupon;
--commit;
delete from tblcoupon where couponseq = 3;
update tblcoupon set name = '쿠폰55', sale = 10,period = sysdate + 4 where couponseq = 3;
select * from tblstoremanager;
select
*
from tblmember
inner join tblAuth
on tblmember.id = tblAuth.id
-- inner join tblStoreManager
-- on tblStoreManager.id = tblmember.id
where tblAuth.AUTH = 'ROLE_ADMIN';
select * from tblevent;
-- insert into tblevent (eventseq ,title , startdate , enddate, sale,pic,pic_board,regdate,count)
-- values (eventseq.nextVal,#{title},#{startdate},#{enddate},#{sale},#{picimg},#{pic_boardimg},sysdate,0 )
--
-- dto.setTitle(title);
-- dto.setStartdate(startdate);
-- dto.setEnddate(enddate);
-- dto.setSale(Integer.parseInt(sale));
-- dto.setPic(picimg);
-- dto.setPic_board(pic_boardimg);
--
--
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰1', 11, sysdate+13);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰2', 5, sysdate+8);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰3', 24, sysdate+9);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰4', 11, sysdate+14);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰5', 11, sysdate+1);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰6', 24, sysdate+12);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰7', 16, sysdate+10);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰8', 12, sysdate+8);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰9', 14, sysdate+1);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰10', 11, sysdate+12);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰11', 29, sysdate+8);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰12', 12, sysdate+4);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰13', 15, sysdate+14);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰14', 28, sysdate+3);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰15', 16, sysdate+5);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰16', 5, sysdate+6);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰17', 12, sysdate+2);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰18', 22, sysdate+2);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰19', 30, sysdate+11);
--INSERT INTO tblcoupon (couponseq, name, sale, period) VALUES (couponseq.nextVal, '쿠폰20', 16, sysdate+15);
select * from tblmember inner join tblAuth on tblmember.id = tblAuth.id;
select * from tblmember where id = (select MAX(id) from tblmember);
select * from tblmember where id = (select MAX(id) from tblmember);
select
*
from tblmember
inner join tblAuth
on tblmember.id = tblAuth.id
where tblmember.id = (select MAX(tblmember.id) from tblmember) and tblAuth.AUTH = 'ROLE_MEMBER';
select * from tblAuth;
--commit;
select * from tblPromise;
select * from tblOrder;
select * from tblcart;
select * from tblOrder;
select * from tblPeriodShip;
select
tblOrder.id , shipdate , shiptime , shipperiod , dayperweek , tblLunchBox.price , orderdate , payment ,orderseq ,tblLunchBox.name, tblPeriodShip.periodshipseq;
, , , , ,,shipdate
select tblPeriodship.periodshipseq, tblOrder.id, tblOrder.orderseq ,tblPeriodShip.shiptime ,tblPeriodShip.dayperweek, tblOrder.price,tblOrder.orderdate, tblOrder.payment, tblOrder.orderseq , tblLunchBox.name ,tblPeriodShip.periodshipseq ,tblPeriodShip.startship,tblPeriodShip.endship from tblOrder
right join tblReview
on tblReview.id = tblOrder.id
right join tblSellBoard
on tblSellBoard.sellboardseq = tblReview.sellboardseq
left join tblLunchboxSet
on tblLunchboxSet.sellboardseq = tblSellBoard.sellboardseq
right join tblLunchBox
on tblLunchBox.lunchboxseq = tblLunchboxSet.lunchboxseq
left join tblCart
on tblCart.id = tblOrder.id
left join tblPeriodShip
on tblCart.periodshipseq = tblPeriodShip.periodshipseq
where tblOrder.id = 'Test';
select * from tblPeriodship;
select * from tblCart;
select * from tblPeriodShip;
select od.id,shipdate,shiptime,shipperiod,dayperweek,price,orderdate,payment from tblOrder od inner join tblCart ca on ca.cartseq = od.cartseq inner join tblPeriodShip ps on ca.periodshipseq = ps.periodshipseq where od.id = '1';
select
tblOrder.id , shipdate , shiptime , shipperiod , dayperweek , tblLunchBox.price , orderdate , payment ,orderseq ,tblLunchBox.name, tblPeriodShip.periodshipseq
from tblOrder
inner join tblCart
on tblCart.cartseq = tblOrder.cartseq
inner join tblPeriodShip
on tblCart.periodshipseq = tblPeriodShip.periodshipseq
inner join tblSellBoard
on tblCart.sellboardseq = tblSellBoard.sellboardseq
inner join tblLunchboxSet
on tblSellBoard.sellboardseq =tblLunchboxSet.sellboardseq
inner join tblLunchBox
on tblLunchBox.lunchboxseq = tblLunchBox.lunchboxseq
where tblOrder.id = '1';
select * from tblAuth;
select
*
from tblmember
inner join tblAuth
on tblmember.id = tblAuth.id
where tblAuth.AUTH = 'ROLE_MEMBER';
select
*
from tblmember
inner join tblAuth
on tblmember.id = tblAuth.id
where tblAuth.AUTH = 'ROLE_ADMIN';
--
--insert into tblEvent values (eventseq.nextVAL,'도시락 먹고 여름 JUNE비 하자',TO_DATE('2023/03/27 12:10:17','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/04/03 23:59:59','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/03/27 12:10:17','YYYY-MM-DD HH24:MI:SS'),27,'EC9DB82CEAB3B5ECA780.jpg','b10eee28b47b90e7b818b408f82bf12b.jpg',0);
--insert into tblEvent values (eventseq.nextVAL,'혼밥러들을 위한 초특가 할인!',TO_DATE('2023/04/28 12:10:17','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/05/01 23:59:59','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/04/28 12:10:17','YYYY-MM-DD HH24:MI:SS'),15,'0428_intro.jpg','7625c248a12a9182a818856566952c53.jpg',0);
--insert into tblEvent values (eventseq.nextVAL,'5월이라 준비했5',TO_DATE('2023/05/04 12:10:17','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/05/14 23:59:59','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/05/04 12:10:17','YYYY-MM-DD HH24:MI:SS'),55,'01.jpg','f11112deea6f0b432477be7fd6f496fb.jpg',0);
--insert into tblEvent values (eventseq.nextVAL,'도시락 먹고 여름 JUNE비 하자',TO_DATE('2023/06/03 12:10:17','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/06/11 23:59:59','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2023/06/03 12:10:17','YYYY-MM-DD HH24:MI:SS'),15,'EC9DB8ED8AB8EBA19C.jpg','c81412d46bf7dd1f7f3401efa4842bed.jpg',0);
--insert into tblEvent values (eventseq.nextVAL,'신규회원이라면 누구나!',sysdate,sysdate,sysdate+1,20,'event-content_1.jpg','event_board_1.jpg',0);
--update tblEvent set enddate = sysdate+365 where eventseq =5;
select * from tblevent;
UPDATE tblevent
SET Title = #{name},
statrtdate = TO_DATE(#{statrtdate}, 'YYYY-MM-DD HH24:MI:SS'),
enddate = TO_DATE(#{statrtdate}, 'YYYY-MM-DD HH24:MI:SS'),
sale = #{sale}
WHERE eventseq = #{eventseq}
--delete from tblevent where eventseq = 5;
--rollback;
--제목 sale enddate pic pic_board regdate
select * from tblevent where enddate < sysdate;
select * from tblevent where enddate > sysdate;
select * from tblevent order by ENDDATE DESC;
select* from (select * from tblevent order by eventseq desc ) where rownum = MAX(eventseq);
select * from tblevent where eventseq = (select MAX(eventseq) from tblevent);
--delete from tblevent;
--Alter SEQUENCE eventseq INCREMENT by 1; SEQUENCE 초기화
--commit;
--update tblEvent set count = count+1 where eventseq = 1;
select * from tblevent where eventseq = 2+1 or eventseq = 2-1;
select
*
from tblmember
inner join tblAuth
on tblmember.id = tblAuth.id
where tblmember.id= 'Test';
select
*
from tblmember
inner join tblAuth
on tblmember.id = tblAuth.id
where tblAuth.AUTH = 'ROLE_MEMBER';
select * from tblCART;
select * from tblorder;
select * from tblReview;
select * from tblsellboard;
select * from tblLunchboxSet;
SELECT tblSellBoard.content, tblOrder.id, tblOrder.orderdate, tblOrder.price, tblOrder.orderseq
FROM tblCart
INNER JOIN tblOrder ON tblCart.id = tblOrder.id
INNER JOIN tblSellBoard ON tblCart.sellboardseq = tblSellBoard.sellboardseq
where tblorder.id = 'tkddn';
select tblOrder.id, tblOrder.orderseq ,tblPeriodShip.shiptime ,tblPeriodShip.dayperweek, tblOrder.price,tblOrder.orderdate, tblOrder.payment, tblOrder.orderseq , tblLunchBox.name ,tblPeriodShip.periodshipseq ,tblPeriodShip.startship,tblPeriodShip.endship from tblOrder
inner join tblReview
on tblReview.id = tblOrder.id
inner join tblSellBoard
on tblSellBoard.sellboardseq = tblReview.sellboardseq
inner join tblLunchboxSet
on tblLunchboxSet.sellboardseq = tblSellBoard.sellboardseq
inner join tblLunchBox
on tblLunchBox.lunchboxseq = tblLunchboxSet.lunchboxseq
right join tblCart
on tblCart.id = tblOrder.id
right join tblPeriodShip
on tblCart.periodshipseq = tblPeriodShip.periodshipseq
where tblOrder.id = 'Test'
GROUP BY tblOrder.id, tblOrder.orderseq, tblPeriodShip.shiptime, tblPeriodShip.dayperweek, tblOrder.price, tblOrder.orderdate, tblOrder.payment, tblLunchBox.name, tblPeriodShip.periodshipseq, tblPeriodShip.startship, tblPeriodShip.endship;
select tblOrder.id, tblOrder.orderseq ,tblPeriodShip.shiptime ,tblPeriodShip.dayperweek, tblOrder.price,tblOrder.orderdate, tblOrder.payment, tblOrder.orderseq , tblLunchBox.name ,tblPeriodShip.periodshipseq ,tblPeriodShip.startship,tblPeriodShip.endship from tblOrder
inner join tblReview
on tblReview.id = tblOrder.id
inner join tblSellBoard
on tblSellBoard.sellboardseq = tblReview.sellboardseq
inner join tblLunchboxSet
on tblLunchboxSet.sellboardseq = tblSellBoard.sellboardseq
inner join tblLunchBox
on tblLunchBox.lunchboxseq = tblLunchboxSet.lunchboxseq
right join tblCart
on tblCart.id = tblOrder.id
right join tblPeriodShip
on tblCart.periodshipseq = tblPeriodShip.periodshipseq
where tblOrder.id = 'tkddn';
select * from tblcart;
SELECT ROWNUM
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ;
(select rnum from (SELECT ROWNUM as rnum
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) c where eventseq =25);
select * from tblevent where eventseq = #{event_seq}+1 or eventseq = #{event_seq}-1;
(select * from (SELECT ROWNUM as rnum
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) c where eventseq =25);
(select * from (SELECT ROWNUM as rnum
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) c where rnum = (select rnum+1 from (SELECT ROWNUM as rnum
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) c where eventseq =25) or (select rnum -1 from (SELECT ROWNUM as rnum
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) c where eventseq =25));
select * from (SELECT ROWNUM
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) where rownum = ( select rownum rownum from (SELECT ROWNUM
, x.*
FROM ( SELECT a.*
FROM tblevent a
ORDER BY a.enddate desc
) x ) where eventseq =25);
select * from tblevent where eventseq = #{event_seq}