プロジェクト

全般

プロフィール

統計
| リビジョン:

h-you / branches / ddl / create_table_mysql.sql @ 94

履歴 | 表示 | アノテート | ダウンロード (16.1 KB)

1
-- Project Name : noname
2
-- Date/Time    : 2017/04/28 18:49:40
3
-- Author       : yamauchi
4
-- RDBMS Type   : MySQL
5
-- Application  : A5:SQL Mk-2
6

    
7
-- ??s?c????}?X?^
8
drop table if exists bankbusinessdaymaster cascade;
9

    
10
create table bankbusinessdaymaster (
11
  YEARMONTH decimal(6,0) default '0' not null comment '?N??'
12
  , BANKBUSINESSDAY decimal(2,0) default '0' not null comment '??s?c???'
13
  , NOTE varchar(120) comment '???l'
14
  , DELETEFLG decimal(1,0) comment '???t???O'
15
  , ENTRYDATE datetime comment '?o?^?N????'
16
  , UPDATEDATE datetime comment '?X?V?N????'
17
  , constraint bankbusinessdaymaster_PKC primary key (YEARMONTH,BANKBUSINESSDAY)
18
) comment '??s?c????}?X?^' ;
19

    
20
-- ???????f?[?^
21
drop table if exists billingdata cascade;
22

    
23
create table billingdata (
24
  COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h'
25
  , TARGETDATE decimal(6,0) default '0' not null comment '???N??'
26
  , SEQNO decimal(3,0) default '0' not null comment '?A??'
27
  , BILLPRICE decimal(10,0) comment '???????z'
28
  , ENTRYDATE datetime comment '?o?^?N????'
29
  , UPDATEDATE datetime comment '?X?V?N????'
30
  , constraint billingdata_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO)
31
) comment '???????f?[?^' ;
32

    
33
-- ??????????f?[?^
34
drop table if exists billingdatadetail cascade;
35

    
36
create table billingdatadetail (
37
  COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h'
38
  , TARGETDATE decimal(6,0) default '0' not null comment '???N??'
39
  , SEQNO decimal(3,0) default '0' not null comment '?A??'
40
  , LINECOUNT decimal(3,0) default '0' not null comment '?s???'
41
  , CONSTRUCTIONCODE decimal(10,0) comment '?H?????'
42
  , FIELDNAME varchar(120) comment '????'
43
  , BILLPRICE decimal(10,0) comment '???????z'
44
  , HIGHWPRICE decimal(10,0) comment '??????'
45
  , HARDWPRICE decimal(10,0) comment '??????'
46
  , INDSWASTETAX decimal(10,0) comment '?Y?p??'
47
  , NOTE varchar(120) comment '???l'
48
  , ENTRYDATE datetime comment '?o?^?N????'
49
  , UPDATEDATE datetime comment '?X?V?N????'
50
  , constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT)
51
) comment '??????????f?[?^' ;
52

    
53
-- ???????x???T?}???[?f?[?^
54
drop table if exists billingpaymentsummary cascade;
55

    
56
create table billingpaymentsummary (
57
  COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h'
58
  , TARGETDATE decimal(6,0) default '0' not null comment '???N??'
59
  , CHARGEPAYMENTKIND decimal(1,0) default '0' not null comment '?????x????'
60
  , PAYDAY date comment '?x????'
61
  , BILLPRICESTOTAL decimal(10,0) comment '???????z???v'
62
  , CONSUMPTIONTAXRATE decimal(6,3) comment '??????'
63
  , CONSUMPTIONTAXPRICE decimal(10,0) comment '?????z'
64
  , HIGHWPRICESTOTAL decimal(10,0) comment '???????v'
65
  , HARDWPRICESTOTAL decimal(10,0) comment '???????v'
66
  , INDSWASTETAXSTOTAL decimal(10,0) comment '?Y?p????v'
67
  , CNSTRPRICERATE decimal(6,3) comment '???????'
68
  , CNSTRPRICESTOTAL decimal(10,0) comment '????????v'
69
  , BILLINGPRICETOTAL decimal(10,0) comment '???????z???v'
70
  , ENTRYDATE datetime comment '?o?^?N????'
71
  , UPDATEDATE datetime comment '?X?V?N????'
72
  , constraint billingpaymentsummary_PKC primary key (COMPANYCODE,TARGETDATE,CHARGEPAYMENTKIND)
73
) comment '???????x???T?}???[?f?[?^' ;
74

    
75
-- ?H????????
76
drop table if exists constructionmaterialinfo cascade;
77

    
78
create table constructionmaterialinfo (
79
  CONSTRUCTIONCODE int(10) unsigned default 0 not null comment '?H?????'
80
  , MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '????i??R?[?h'
81
  , RENTCOUNT smallint(5) unsigned comment '??o??'
82
  , REPAYCOUNT smallint(5) unsigned comment '??p??'
83
  , COMPLETEFLG tinyint(3) unsigned comment '?????t???O'
84
  , ENTRYDATE datetime comment '?o?^???t'
85
  , UPDATEDATE datetime comment '?X?V???t'
86
  , constraint constructionmaterialinfo_PKC primary key (CONSTRUCTIONCODE,MATERIALITEMCODE)
87
) comment '?H????????' ;
88

    
89
-- ?????}?X?^
90
drop table if exists deadlinemaster cascade;
91

    
92
create table deadlinemaster (
93
  LABOURKIND decimal(1,0) default '0' not null comment '??????'
94
  , DEADLINE decimal(2,0) comment '????'
95
  , PAYDAY decimal(2,0) comment '?x????'
96
  , NOTE varchar(120) comment '???l'
97
  , DELETEFLG decimal(1,0) comment '???t???O'
98
  , ENTRYDATE datetime comment '?o?^???t'
99
  , UPDATEDATE datetime comment '?X?V???t'
100
  , constraint deadlinemaster_PKC primary key (LABOURKIND)
101
) comment '?????}?X?^' ;
102

    
103
-- ?????m?F???F?f?[?^
104
drop table if exists depositapprovalinfo cascade;
105

    
106
create table depositapprovalinfo (
107
  ORDERERSDIVISION decimal(5,0) not null comment '???????'
108
  , ORDERERSCODE decimal(5,0) not null comment '??????R?[?h'
109
  , TARGETDATE decimal(6,0) not null comment '???N??'
110
  , SEQNO decimal(3,0) not null comment '?A??'
111
  , LINECOUNT decimal(3,0) not null comment '?s???'
112
  , APPROVALNO decimal(3,0) not null comment '???F????'
113
  , APPROVALPERSON decimal(8,0) comment '???F??R?[?h'
114
  , APPROVALPERSONNAME varchar(20) comment '???F???'
115
  , APPROVALAUTHORITY decimal(1,0) comment '???F??????'
116
  , APPROVALDATE date comment '???F???t'
117
  , ENTRYDATE datetime comment '?o?^???t'
118
  , UPDATEDATE datetime comment '?X?V???t'
119
  , constraint depositapprovalinfo_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO)
120
) comment '?????m?F???F?f?[?^' ;
121

    
122
-- ?????f?[?^
123
drop table if exists depositdata cascade;
124

    
125
create table depositdata (
126
  ORDERERSDIVISION decimal(5,0) not null comment '???????'
127
  , ORDERERSCODE decimal(5,0) not null comment '??????R?[?h'
128
  , TARGETDATE decimal(6,0) not null comment '???N??'
129
  , SEQNO decimal(3,0) not null comment '?A??'
130
  , BusinessPeriod decimal(4,0) comment '?c???'
131
  , DEPOSITDATE date comment '??????'
132
  , DepositAmount decimal(12,0) comment '???????z'
133
  , DEPOSITAMOUNTCASH decimal(10,0) comment '???????z?i?????j'
134
  , DEPOSITAMOUNTBILL decimal(10,0) comment '???????z?i??`?j'
135
  , ENTRYDATE datetime comment '?o?^???t'
136
  , UPDATEDATE datetime comment '?X?V???t'
137
  , constraint depositdata_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO)
138
) comment '?????f?[?^' ;
139

    
140
-- ????????f?[?^
141
drop table if exists depositdatadetail cascade;
142

    
143
create table depositdatadetail (
144
  ORDERERSDIVISION decimal(5,0) not null comment '???????'
145
  , ORDERERSCODE decimal(5,0) not null comment '??????R?[?h'
146
  , TARGETDATE decimal(6,0) not null comment '???N??'
147
  , SEQNO decimal(3,0) not null comment '?A??'
148
  , LINECOUNT decimal(3,0) not null comment '?s???'
149
  , REQUESTNO decimal(10,0) comment '????No'
150
  , ORDERNO decimal(2,0) comment '??t???'
151
  , DEPOSITAMOUNT decimal(10,0) comment '???????z'
152
  , DISCOUNTAMOUNT decimal(10,0) comment '?l???????z'
153
  , CNSTRPRICE decimal(10,0) comment '?????'
154
  , FEES decimal(10,0) comment '????'
155
  , OTHERADJUSTMENTS decimal(10,0) comment '?????????'
156
  , CARRYAMOUNT decimal(10,0) comment '?J?z???z'
157
  , APPROVALPERSONCODE decimal(8,0) comment '???F?S????R?[?h'
158
  , APPROVALDATE date comment '?S??????F???t'
159
  , APPROVALENDFLG decimal(1,0) comment '???F?????t???O'
160
  , ENTRYDATE datetime comment '?o?^???t'
161
  , UPDATEDATE datetime comment '?X?V???t'
162
  , constraint depositdatadetail_PKC primary key (ORDERERSDIVISION,ORDERERSCODE,TARGETDATE,SEQNO,LINECOUNT)
163
) comment '????????f?[?^' ;
164

    
165
-- ???????f?[?^
166
drop table if exists invoicedata cascade;
167

    
168
create table invoicedata (
169
  INVOICENO decimal(9,0) not null comment '??????No'
170
  , ORDERERSDIVISION decimal(5,0) not null comment '???????'
171
  , ORDERERSCODE decimal(5,0) not null comment '??????R?[?h'
172
  , REQUESTMONTH decimal(6,0) not null comment '??????'
173
  , SEQNO decimal(2,0) not null comment '?A??'
174
  , CRETATEDATE date not null comment '????'
175
  , REQUESTDATE date not null comment '??????'
176
  , REQUESTNAME varchar(120) comment '??????'
177
  , TOTALAMOUNT decimal(10,0) comment '???????v???z'
178
  , TAXAMOUNT decimal(10,0) comment '???????z'
179
  , COMMENT1 varchar(60) comment '?R?????g1'
180
  , COMMENT2 varchar(60) comment '?R?????g2'
181
  , COMMENT3 varchar(60) not null comment '?R?????g3'
182
  , COMMENT4 varchar(60) not null comment '?R?????g4'
183
  , COMMENT5 varchar(60) not null comment '?R?????g5'
184
  , COMPLETEFLG decimal(1,0) default '0' not null comment '?????t???O'
185
  , ENTRYDATE datetime not null comment '?o?^?N????'
186
  , UPDATEDATE datetime not null comment '?X?V?N????'
187
  , constraint invoicedata_PKC primary key (INVOICENO)
188
) comment '???????f?[?^' ;
189

    
190
alter table invoicedata add unique ORDERERSDIVISION (ORDERERSDIVISION,ORDERERSCODE,REQUESTMONTH,SEQNO) ;
191

    
192
-- ??????
193
drop table if exists materialinfo cascade;
194

    
195
create table materialinfo (
196
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '????i??R?[?h'
197
  , MATERIALCOUNT smallint(5) unsigned comment '?????'
198
  , RENTCOUNT smallint(5) unsigned comment '??o??\??'
199
  , DELETEFLG smallint(5) unsigned comment '???t???O'
200
  , ENTRYDATE datetime comment '?o?^???t'
201
  , UPDATEDATE datetime comment '?X?V???t'
202
  , constraint materialinfo_PKC primary key (MATERIALITEMCODE)
203
) comment '??????' ;
204

    
205
-- ????i??}?X?^
206
drop table if exists materialitemmaster cascade;
207

    
208
create table materialitemmaster (
209
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '????i??R?[?h'
210
  , MATERIALKINDCODE smallint(5) unsigned comment '??????R?[?h'
211
  , MATERIALITEMNAME varchar(40) comment '????i?????'
212
  , DISPLAYORDER smallint(5) unsigned comment '?\????'
213
  , DELETEFLG tinyint(3) unsigned comment '???t???O'
214
  , ENTRYDATE datetime comment '?o?^???t'
215
  , UPDATEDATE datetime comment '?X?V???t'
216
  , constraint materialitemmaster_PKC primary key (MATERIALITEMCODE)
217
) comment '????i??}?X?^' ;
218

    
219
-- ??????}?X?^
220
drop table if exists materialkindmaster cascade;
221

    
222
create table materialkindmaster (
223
  MATERIALKINDCODE smallint(5) unsigned default 0 not null comment '??????R?[?h'
224
  , MATERIALKINDNAME varchar(40) comment '?????????'
225
  , DISPLAYORDER smallint(5) unsigned comment '?\????'
226
  , DELETEFLG tinyint(3) unsigned comment '???t???O'
227
  , ENTRYDATE datetime comment '?o?^???t'
228
  , UPDATEDATE datetime comment '?X?V???t'
229
  , constraint materialkindmaster_PKC primary key (MATERIALKINDCODE)
230
) comment '??????}?X?^' ;
231

    
232
-- ??????????
233
drop table if exists materialrecordinfo cascade;
234

    
235
create table materialrecordinfo (
236
  MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '????i??R?[?h'
237
  , PROCESSDATE date default '0000-00-00' not null comment '?????N????'
238
  , SEQNO smallint(5) unsigned default 0 not null comment '?A??'
239
  , RECKIND tinyint(3) unsigned comment '???R?[?h??'
240
  , CONSTRUCTIONCODE int(10) unsigned comment '?H?????'
241
  , PERSONCODE int(10) unsigned comment '?S????R?[?h'
242
  , MATERIALCOUNT smallint(5) unsigned comment '?????'
243
  , REPAYPLANDATE date comment '??p?\??N????'
244
  , COMMENTTEXT varchar(80) comment '?R?????g'
245
  , ENTRYDATE datetime comment '?o?^???t'
246
  , UPDATEDATE datetime comment '?X?V???t'
247
  , constraint materialrecordinfo_PKC primary key (MATERIALITEMCODE,PROCESSDATE,SEQNO)
248
) comment '??????????' ;
249

    
250
-- ?x?????F???f?[?^
251
drop table if exists paymentapprovalinfo cascade;
252

    
253
create table paymentapprovalinfo (
254
  COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h'
255
  , TARGETDATE decimal(6,0) default '0' not null comment '???N??'
256
  , SEQNO decimal(3,0) default '0' not null comment '?A??'
257
  , LINECOUNT decimal(3,0) default '0' not null comment '?s???'
258
  , APPROVALNO decimal(3,0) default '0' not null comment '???F????'
259
  , APPROVALPERSON decimal(8,0) comment '???F??R?[?h'
260
  , APPROVALPERSONNAME varchar(20) comment '???F???'
261
  , APPROVALAUTHORITY decimal(1,0) comment '???F??????'
262
  , APPROVALDATE date comment '???F???t'
263
  , ENTRYDATE datetime comment '?o?^???t'
264
  , UPDATEDATE datetime comment '?X?V???t'
265
  , constraint paymentapprovalinfo_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT,APPROVALNO)
266
) comment '?x?????F???f?[?^' ;
267

    
268
-- ?x??????f?[?^
269
drop table if exists paymentdatadetail cascade;
270

    
271
create table paymentdatadetail (
272
  COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h'
273
  , TARGETDATE decimal(6,0) default '0' not null comment '???N??'
274
  , SEQNO decimal(3,0) default '0' not null comment '?A??'
275
  , LINECOUNT decimal(3,0) default '0' not null comment '?s???'
276
  , BILLPRICE decimal(10,0) comment '???????z'
277
  , DISCOUNTPRICE decimal(10,0) comment '?l???????z'
278
  , OFFSETPRICE decimal(10,0) comment '???E???z'
279
  , NEXTCOPRICE decimal(10,0) comment '????J?z'
280
  , HIGHWPRICE decimal(10,0) comment '??????'
281
  , HARDWPRICE decimal(10,0) comment '??????'
282
  , INDSWASTETAX decimal(10,0) comment '?Y?p??'
283
  , CNSTRPRICE decimal(10,0) comment '?????'
284
  , CNSTRPRICEEXIST decimal(1,0) comment '??????L??'
285
  , APPROVALPERSONCODE decimal(8,0) comment '???F?S????R?[?h'
286
  , APPROVALDATE date comment '?S??????F???t'
287
  , APPROVALENDFLG decimal(1,0) comment '???F?????t???O'
288
  , ENTRYDATE datetime comment '?o?^???t'
289
  , UPDATEDATE datetime comment '?X?V???t'
290
  , constraint paymentdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,SEQNO,LINECOUNT)
291
) comment '?x??????f?[?^' ;
292

    
293
-- ?????f?[?^
294
drop table if exists requestdata cascade;
295

    
296
create table requestdata (
297
  REQUESTNO decimal(9,0) not null comment '????No'
298
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '?{?H?????'
299
  , CONSTRUCTIONNAME varchar(120) not null comment '?H??????'
300
  , CONTRACTAMOUNT decimal(10,0) not null comment '???????z'
301
  , PAIDAMOUNT decimal(10,0) not null comment '????????z'
302
  , REQUESTAMOUNT0 decimal(10,0) not null comment '???????z?O'
303
  , REQUESTAMOUNT1 decimal(10,0) not null comment '???????z?P'
304
  , REQUESTAMOUNT2 decimal(10,0) comment '???????z?Q'
305
  , REQUESTAMOUNT3 decimal(10,0) comment '???????z?R'
306
  , REQUESTAMOUNT4 decimal(10,0) comment '???????z?S'
307
  , REQUESTAMOUNT5 decimal(10,0) comment '???????z?T'
308
  , REQUESTAMOUNT6 decimal(10,0) comment '???????z?U'
309
  , UNCLAIMEDAMOUNT decimal(10,0) not null comment '?????c???z'
310
  , UNPAIDAMOUNT decimal(10,0) not null comment '?????????z'
311
  , TAXAMOUNT decimal(10,0) not null comment '?????'
312
  , NOTE varchar(120) not null comment '???l'
313
  , ENTRYDATE datetime not null comment '?o?^?N????'
314
  , UPDATEDATE datetime not null comment '?X?V?N????'
315
  , constraint requestdata_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE)
316
) comment '?????f?[?^' ;
317

    
318
-- ?????f?[?^????
319
drop table if exists requestdatadetail cascade;
320

    
321
create table requestdatadetail (
322
  REQUESTNO decimal(9,0) not null comment '????No'
323
  , MAINCONSTRUCTIONCODE decimal(10,0) not null comment '?{?H?????'
324
  , CONSTRUCTIONCODE decimal(10,0) not null comment '?H?????'
325
  , CONSTRUCTIONKIND decimal(1,0) not null comment '?H????'
326
  , REQUESTAMOUNT decimal(10,0) not null comment '???????z'
327
  , TAXAMOUNT decimal(10,0) not null comment '?????'
328
  , ENTRYDATE datetime not null comment '?o?^?N????'
329
  , UPDATEDATE datetime not null comment '?X?V?N????'
330
  , constraint requestdatadetail_PKC primary key (REQUESTNO,MAINCONSTRUCTIONCODE,CONSTRUCTIONCODE,CONSTRUCTIONKIND)
331
) comment '?????f?[?^????' ;
332

    
333
-- ?????w?b?_
334
drop table if exists requesthead cascade;
335

    
336
create table requesthead (
337
  REQUESTNO decimal(9,0) not null comment '????No'
338
  , REQCONSTRUCTIONCODE decimal(10,0) not null comment '?????H?????'
339
  , ORDERNO decimal(2,0) not null comment '??t???'
340
  , REQUESTMONTH decimal(6,0) not null comment '??????'
341
  , ORDERERSDIVISION decimal(5,0) not null comment '???????'
342
  , ORDERERSCODE decimal(5,0) not null comment '??????R?[?h'
343
  , ORDERERSNAME varchar(120) not null comment '???????'
344
  , REQCONSTRUCTIONNAME varchar(120) not null comment '?????H??????'
345
  , REQUESTTOTALAMOUNT decimal(10,0) not null comment '???????z???v'
346
  , REQUESTAMOUNT decimal(10,0) not null comment '???????z'
347
  , TAXAMOUNT decimal(10,0) not null comment '?????'
348
  , UNPAIDAMOUNT decimal(10,0) comment '??????'
349
  , NOTE varchar(120) comment '???l'
350
  , ASSIGNEDFLG decimal(1,0) comment '??????t???O'
351
  , INVOICENO decimal(9,0) not null comment '??????No'
352
  , ENTRYDATE datetime not null comment '?o?^?N????'
353
  , UPDATEDATE datetime not null comment '?X?V?N????'
354
  , constraint requesthead_PKC primary key (REQUESTNO)
355
) comment '?????w?b?_' ;
356

    
357
alter table requesthead add unique REQCONSTRUCTIONCODE (REQCONSTRUCTIONCODE,ORDERNO) ;
358