~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
DROP TABLE IF EXISTS t1;
2
CREATE TABLE t1 (
3
cont_nr int(11) NOT NULL auto_increment,
4
ver_nr int(11) NOT NULL default '0',
5
aufnr int(11) NOT NULL default '0',
6
username varchar(50) NOT NULL default '',
7
hdl_nr int(11) NOT NULL default '0',
8
eintrag date NOT NULL default '0000-00-00',
9
st_klasse varchar(40) NOT NULL default '',
10
st_wert varchar(40) NOT NULL default '',
11
st_zusatz varchar(40) NOT NULL default '',
12
st_bemerkung varchar(255) NOT NULL default '',
13
kunden_art varchar(40) NOT NULL default '',
14
mcbs_knr int(11) default NULL,
15
mcbs_aufnr int(11) NOT NULL default '0',
16
schufa_status char(1) default '?',
17
bemerkung text,
18
wirknetz text,
19
wf_igz int(11) NOT NULL default '0',
20
tarifcode varchar(80) default NULL,
21
recycle char(1) default NULL,
22
sim varchar(30) default NULL,
23
mcbs_tpl varchar(30) default NULL,
24
emp_nr int(11) NOT NULL default '0',
25
laufzeit int(11) default NULL,
26
hdl_name varchar(30) default NULL,
27
prov_hdl_nr int(11) NOT NULL default '0',
28
auto_wirknetz varchar(50) default NULL,
29
auto_billing varchar(50) default NULL,
30
touch timestamp NOT NULL,
31
kategorie varchar(50) default NULL,
32
kundentyp varchar(20) NOT NULL default '',
33
sammel_rech_msisdn varchar(30) NOT NULL default '',
34
p_nr varchar(9) NOT NULL default '',
35
suffix char(3) NOT NULL default '',
36
PRIMARY KEY (cont_nr),
37
KEY idx_aufnr(aufnr),
38
KEY idx_hdl_nr(hdl_nr),
39
KEY idx_st_klasse(st_klasse),
40
KEY ver_nr(ver_nr),
41
KEY eintrag_idx(eintrag),
42
KEY emp_nr_idx(emp_nr),
43
KEY wf_igz(wf_igz),
44
KEY touch(touch),
45
KEY hdl_tag(eintrag,hdl_nr),
46
KEY prov_hdl_nr(prov_hdl_nr),
47
KEY mcbs_aufnr(mcbs_aufnr),
48
KEY kundentyp(kundentyp),
49
KEY p_nr(p_nr,suffix)
50
) ENGINE=MyISAM;
51
INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
52
INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
53
INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
54
INSERT INTO t1 VALUES (3359359,468,3359359,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1507831,2143894,'+','','P',1909162,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
55
INSERT INTO t1 VALUES (3359360,0,0,'Mustermann Musterfrau',29674907,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1900169997,2414578,'+',NULL,'N',1909148,'',NULL,NULL,'RV99066_2',20,NULL,'POS',29674907,NULL,NULL,20010202105916,'Mobilfunk','','','97317481','007');
56
INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag storniert','','(7001-84):Storno, Kd. möchte nicht mehr','privat',NULL,0,'+','','P',1909150,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
57
INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
58
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
59
Kundentyp	kategorie
60
Privat (Private Nutzung)	Mobilfunk
61
Warnings:
62
Warning	1052	Column 'kundentyp' in group statement is ambiguous
63
drop table t1;
64
CREATE TABLE t1 (
65
AUFNR varchar(12) NOT NULL default '',
66
PLNFL varchar(6) NOT NULL default '',
67
VORNR varchar(4) NOT NULL default '',
68
xstatus_vor smallint(5) unsigned NOT NULL default '0'
69
);
70
INSERT INTO t1 VALUES ('40004712','000001','0010',9);
71
INSERT INTO t1 VALUES ('40004712','000001','0020',0);
72
UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr =
73
"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr
74
ASC LIMIT 1;
75
drop table t1;
76
drop table if exists t1,t2,t3;
77
create table t1 (a int, b int, c int);
78
create table t2 (d int);
79
create table t3 (a1 int, b1 int, c1 int);
80
insert into t1 values(1,2,3);
81
insert into t1 values(11,22,33);
82
insert into t2 values(99);
83
select t1.* as 'with_alias' from t1;
84
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
85
select t2.* as 'with_alias' from t2;
86
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t2' at line 1
87
select t1.*, t1.* as 'with_alias' from t1;
88
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
89
select t1.* as 'with_alias', t1.* from t1;
90
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', t1.* from t1' at line 1
91
select t1.* as 'with_alias', t1.* as 'alias2' from t1;
92
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', t1.* as 'alias2' from t1' at line 1
93
select t1.* as 'with_alias', a, t1.* as 'alias2' from t1;
94
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', a, t1.* as 'alias2' from t1' at line 1
95
select a, t1.* as 'with_alias' from t1;
96
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
97
select t1.* as 'with_alias', a from t1;
98
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', a from t1' at line 1
99
select a, t1.* as 'with_alias', b from t1;
100
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', b from t1' at line 1
101
select (select d from t2 where d > a), t1.* as 'with_alias' from t1;
102
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
103
select t1.* as 'with_alias', (select a from t2 where d > a) from t1;
104
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', (select a from t2 where d > a) from t1' at line 1
105
select a as 'x', t1.* as 'with_alias' from t1;
106
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
107
select t1.* as 'with_alias', a as 'x' from t1;
108
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', a as 'x' from t1' at line 1
109
select a as 'x', t1.* as 'with_alias', b as 'x' from t1;
110
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', b as 'x' from t1' at line 1
111
select (select d from t2 where d > a) as 'x', t1.* as 'with_alias' from t1;
112
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
113
select t1.* as 'with_alias', (select a from t2 where d > a) as 'x' from t1;
114
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', (select a from t2 where d > a) as 'x' from t1' at line 1
115
select (select t2.* as 'x' from t2) from t1;
116
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'x' from t2) from t1' at line 1
117
select a, (select t2.* as 'x' from t2) from t1;
118
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'x' from t2) from t1' at line 1
119
select t1.*, (select t2.* as 'x' from t2) from t1;
120
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'x' from t2) from t1' at line 1
121
insert into t3 select t1.* as 'with_alias' from t1;
122
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
123
insert into t3 select t2.* as 'with_alias', 1, 2 from t2;
124
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', 1, 2 from t2' at line 1
125
insert into t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
126
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', d as 'x', d as 'z' from t2' at line 1
127
insert into t3 select t2.*, t2.* as 'with_alias', 3 from t2;
128
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', 3 from t2' at line 1
129
create table t3 select t1.* as 'with_alias' from t1;
130
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias' from t1' at line 1
131
create table t3 select t2.* as 'with_alias', 1, 2 from t2;
132
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', 1, 2 from t2' at line 1
133
create table t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
134
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', d as 'x', d as 'z' from t2' at line 1
135
create table t3 select t2.*, t2.* as 'with_alias', 3 from t2;
136
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 'with_alias', 3 from t2' at line 1
137
select t1.* from t1;
138
a	b	c
139
1	2	3
140
11	22	33
141
select t2.* from t2;
142
d
143
99
144
select t1.*, t1.* from t1;
145
a	b	c	a	b	c
146
1	2	3	1	2	3
147
11	22	33	11	22	33
148
select t1.*, a, t1.* from t1;
149
a	b	c	a	a	b	c
150
1	2	3	1	1	2	3
151
11	22	33	11	11	22	33
152
select a, t1.* from t1;
153
a	a	b	c
154
1	1	2	3
155
11	11	22	33
156
select t1.*, a from t1;
157
a	b	c	a
158
1	2	3	1
159
11	22	33	11
160
select a, t1.*, b from t1;
161
a	a	b	c	b
162
1	1	2	3	2
163
11	11	22	33	22
164
select (select d from t2 where d > a), t1.* from t1;
165
(select d from t2 where d > a)	a	b	c
166
99	1	2	3
167
99	11	22	33
168
select t1.*, (select a from t2 where d > a) from t1;
169
a	b	c	(select a from t2 where d > a)
170
1	2	3	1
171
11	22	33	11
172
select a as 'x', t1.* from t1;
173
x	a	b	c
174
1	1	2	3
175
11	11	22	33
176
select t1.*, a as 'x' from t1;
177
a	b	c	x
178
1	2	3	1
179
11	22	33	11
180
select a as 'x', t1.*, b as 'x' from t1;
181
x	a	b	c	x
182
1	1	2	3	2
183
11	11	22	33	22
184
select (select d from t2 where d > a) as 'x', t1.* from t1;
185
x	a	b	c
186
99	1	2	3
187
99	11	22	33
188
select t1.*, (select a from t2 where d > a) as 'x' from t1;
189
a	b	c	x
190
1	2	3	1
191
11	22	33	11
192
select (select t2.* from t2) from t1;
193
(select t2.* from t2)
194
99
195
99
196
select a, (select t2.* from t2) from t1;
197
a	(select t2.* from t2)
198
1	99
199
11	99
200
select t1.*, (select t2.* from t2) from t1;
201
a	b	c	(select t2.* from t2)
202
1	2	3	99
203
11	22	33	99
204
insert into t3 select t1.* from t1;
205
insert into t3 select t2.*, 1, 2 from t2;
206
insert into t3 select t2.*, d as 'x', d as 'z' from t2;
207
insert into t3 select t2.*, t2.*, 3 from t2;
208
create table t4 select t1.* from t1;
209
drop table t4;
210
create table t4 select t2.*, 1, 2 from t2;
211
drop table t4;
212
create table t4 select t2.*, d as 'x', d as 'z' from t2;
213
drop table t4;
214
drop table t1,t2,t3;