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
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
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)
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
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;
22
18446744073709551615 18446744073709551615 0
23
select -1 | 1, -1 ^ 1, -1 & 1;
25
18446744073709551615 18446744073709551614 1
26
select 1 | -1, 1 ^ -1, 1 & -1;
28
18446744073709551615 18446744073709551614 1
29
select 0 | -1, 0 ^ -1, 0 & -1;
31
18446744073709551615 18446744073709551615 0
32
select -1 >> 0, -1 << 0;
34
18446744073709551615 18446744073709551615
35
select -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;