47 lines
792 B
Plaintext
47 lines
792 B
Plaintext
drop table if exists tt1;
|
|
create table tt1(c1 int primary key, c2 int);
|
|
insert into tt1 values(1,4);
|
|
insert into tt1 values(2,3);
|
|
select c1, c2 as c1 from tt1;
|
|
c1 c1
|
|
1 4
|
|
2 3
|
|
select c1, c2 as c1 from tt1 order by c1;
|
|
ERROR 23000: Column 'c1' in order clause is ambiguous
|
|
select c2 as c1 from tt1 order by c1;
|
|
c1
|
|
3
|
|
4
|
|
select c2 as c1 from tt1 where c1<4;
|
|
c1
|
|
4
|
|
3
|
|
select c1 as cc, c2 as c1 from tt1 where c1<4;
|
|
cc c1
|
|
1 4
|
|
2 3
|
|
select c1 as cc, c2 as c1 from tt1 order by c1;
|
|
cc c1
|
|
2 3
|
|
1 4
|
|
select c1, c2 as c1 from tt1 where c1<4;
|
|
c1 c1
|
|
1 4
|
|
2 3
|
|
select c2 as cc from tt1 order by c1;
|
|
cc
|
|
4
|
|
3
|
|
select c2 as c1 from tt1 order by c1;
|
|
c1
|
|
3
|
|
4
|
|
select c1 as c1, c2 as c1 from tt1 where c1<4;
|
|
c1 c1
|
|
1 4
|
|
2 3
|
|
show columns from tt1;
|
|
Field Type Null Key Default Extra
|
|
c1 int(11) NO PRI NULL
|
|
c2 int(11) YES NULL
|