1
by brian
clean slate |
1 |
select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
|
2 |
1+1 1-1 1+1*2 8/5 8%5 mod(8,5) mod(8,5)|0 -(1+1)*-2
|
|
3 |
2 0 3 1.6000 3 3 3 4
|
|
4 |
explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
|
|
5 |
id select_type table type possible_keys key key_len ref rows filtered Extra
|
|
6 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
7 |
Warnings:
|
|
8 |
Note 1003 select (1 + 1) AS "1+1",(1 - 1) AS "1-1",(1 + (1 * 2)) AS "1+1*2",(8 / 5) AS "8/5",(8 % 5) AS "8%5",(8 % 5) AS "mod(8,5)",((8 % 5) | 0) AS "mod(8,5)|0",(-((1 + 1)) * -(2)) AS "-(1+1)*-2"
|
|
9 |
select 1 | (1+1),5 & 3,bit_count(7) ;
|
|
10 |
1 | (1+1) 5 & 3 bit_count(7)
|
|
11 |
3 1 3
|
|
12 |
explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
|
|
13 |
id select_type table type possible_keys key key_len ref rows filtered Extra
|
|
14 |
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
15 |
Warnings:
|
|
16 |
Note 1003 select (1 | (1 + 1)) AS "1 | (1+1)",(5 & 3) AS "5 & 3",bit_count(7) AS "bit_count(7)"
|
|
17 |
select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
|
|
18 |
1 << 32 1 << 63 1 << 64 4 >> 2 4 >> 63 1<< 63 >> 60
|
|
19 |
4294967296 9223372036854775808 0 1 0 8
|
|
20 |
select -1 | 0, -1 ^ 0, -1 & 0;
|
|
21 |
-1 | 0 -1 ^ 0 -1 & 0
|
|
22 |
18446744073709551615 18446744073709551615 0
|
|
23 |
select -1 | 1, -1 ^ 1, -1 & 1;
|
|
24 |
-1 | 1 -1 ^ 1 -1 & 1
|
|
25 |
18446744073709551615 18446744073709551614 1
|
|
26 |
select 1 | -1, 1 ^ -1, 1 & -1;
|
|
27 |
1 | -1 1 ^ -1 1 & -1
|
|
28 |
18446744073709551615 18446744073709551614 1
|
|
29 |
select 0 | -1, 0 ^ -1, 0 & -1;
|
|
30 |
0 | -1 0 ^ -1 0 & -1
|
|
31 |
18446744073709551615 18446744073709551615 0
|
|
32 |
select -1 >> 0, -1 << 0;
|
|
33 |
-1 >> 0 -1 << 0
|
|
34 |
18446744073709551615 18446744073709551615
|
|
35 |
select -1 >> 1, -1 << 1;
|
|
36 |
-1 >> 1 -1 << 1
|
|
37 |
9223372036854775807 18446744073709551614
|
|
38 |
drop table if exists t1,t2;
|
|
39 |
create table t1(a int);
|
|
40 |
create table t2(a int, b int);
|
|
41 |
insert into t1 values (1), (2), (3);
|
|
42 |
insert into t2 values (1, 7), (3, 7);
|
|
43 |
select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
|
|
44 |
a a b bit_count(t2.b)
|
|
45 |
1 1 7 3
|
|
46 |
2 NULL NULL NULL
|
|
47 |
3 3 7 3
|
|
48 |
drop table t1, t2;
|