Project

General

Profile

Mlmsalesreport table schema » History » Version 1

chin-yeh, 02/09/2012 05:06 PM

1 1 chin-yeh
h1. mlmsalesreport table schema
2
3
<pre>
4
<code class="SQL">
5
6
7
DROP TABLE T_REALMLM_SALES_LIST
8
;
9
10
11
12
13
DROP TABLE T_REALMLM_SALES
14
;
15
16
17
18
19
DROP TABLE T_REALMLM
20
;
21
22
23
24
CREATE TABLE T_REALMLM
25
(
26
	SEQ  INTEGER NULL,
27
	COMPANY_CODE  VARCHAR(4) NULL,
28
	JOBCODE  VARCHAR(2) NULL,
29
	STATE  VARCHAR(10) NULL,
30
	ERRCODE  VARCHAR(10) NULL,
31
	ERRORMSG  VARCHAR(500) NULL,
32
	GUARANTE_NUM  VARCHAR(17) NULL,
33
	REGIDAY  DATE NULL,
34
	SEANDAY  DATE NULL,
35
	RECVDAY  DATE NULL
36
)
37
;
38
39
40
41
ALTER TABLE T_REALMLM
42
	ADD  PRIMARY KEY (SEQ)
43
;
44
45
46
47
CREATE TABLE T_REALMLM_SALES
48
(
49
	SEQ  INTEGER NOT NULL,
50
	SALEORDER_NUM  VARCHAR(30) NULL,
51
	ORDER_TYPE  VARCHAR(10) NULL,
52
	MEMBER_KIND  VARCHAR(1) NULL,
53
	MEMBER_NAME  VARCHAR(30) NULL,
54
	MEMBER_NUM  VARCHAR(14) NULL,
55
	RESIDENT_NUM  VARCHAR(13) NULL,
56
	TEL_NO  VARCHAR(20) NULL,
57
	MOBILE_NO  VARCHAR(20) NULL,
58
	POST_NO1  VARCHAR(6) NULL,
59
	POST_ADDR1  VARCHAR(120) NULL,
60
	POST_ADDR2  VARCHAR(120) NULL,
61
	SALES_CARD  NUMERIC(12) NULL,
62
	SALES_CASH  NUMERIC(12) NULL,
63
	SALES_SENDAMT  NUMERIC(12) NULL,
64
	SALES_DT  VARCHAR(8) NULL,
65
	OLD_ORDER_NUM  VARCHAR(30) NULL,
66
	OLD_ORDER_SEQ  VARCHAR(30) NULL,
67
	DELIVERY_QUANTITY  NUMERIC(4) NULL,
68
	DELIVERY_SEQ  VARCHAR(30) NULL,
69
	DELIVERY_DT  VARCHAR(8) NULL
70
)
71
;
72
73
74
75
ALTER TABLE T_REALMLM_SALES
76
	ADD  PRIMARY KEY (SEQ)
77
;
78
79
80
81
CREATE TABLE T_REALMLM_SALES_LIST
82
(
83
	SEQ  INTEGER NOT NULL,
84
	ORDER_SEQ  VARCHAR(30) NULL,
85
	GOODS_NAME  VARCHAR(80) NULL,
86
	GOODS_COST  NUMERIC(8) NULL,
87
	QUANTITY  NUMERIC(4) NULL,
88
	OLD_ORDER_NUM  VARCHAR(30) NULL,
89
	OLD_ORDER_SEQ  VARCHAR(30) NULL
90
)
91
;
92
93
94
95
ALTER TABLE T_REALMLM_SALES_LIST
96
	ADD  PRIMARY KEY (SEQ,ORDER_SEQ)
97
;
98
99
100
101
ALTER TABLE T_REALMLM_SALES
102
	ADD FOREIGN KEY R_35 (SEQ) REFERENCES T_REALMLM(SEQ)
103
;
104
105
106
107
ALTER TABLE T_REALMLM_SALES_LIST
108
	ADD FOREIGN KEY R_36 (SEQ) REFERENCES T_REALMLM_SALES(SEQ)
109
;
110
111
</code>
112
</pre>