ndb_basic.result
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· RESULT 代码 · 共 845 行 · 第 1/2 页
RESULT
845 行
2 NULLselect * from t1 where b IS NOT NULL;a b1 drop table t1;create table t1 (c1 int,c2 int,c3 int,c4 int,c5 int,c6 int,c7 int,c8 int,c9 int,c10 int,c11 int,c12 int,c13 int,c14 int,c15 int,c16 int,c17 int,c18 int,c19 int,c20 int,c21 int,c22 int,c23 int,c24 int,c25 int,c26 int,c27 int,c28 int,c29 int,c30 int,c31 int,c32 int,c33 int,c34 int,c35 int,c36 int,c37 int,c38 int,c39 int,c40 int,c41 int,c42 int,c43 int,c44 int,c45 int,c46 int,c47 int,c48 int,c49 int,c50 int,c51 int,c52 int,c53 int,c54 int,c55 int,c56 int,c57 int,c58 int,c59 int,c60 int,c61 int,c62 int,c63 int,c64 int,c65 int,c66 int,c67 int,c68 int,c69 int,c70 int,c71 int,c72 int,c73 int,c74 int,c75 int,c76 int,c77 int,c78 int,c79 int,c80 int,c81 int,c82 int,c83 int,c84 int,c85 int,c86 int,c87 int,c88 int,c89 int,c90 int,c91 int,c92 int,c93 int,c94 int,c95 int,c96 int,c97 int,c98 int,c99 int,c100 int,c101 int,c102 int,c103 int,c104 int,c105 int,c106 int,c107 int,c108 int,c109 int,c110 int,c111 int,c112 int,c113 int,c114 int,c115 int,c116 int,c117 int,c118 int,c119 int,c120 int,c121 int,c122 int,c123 int,c124 int,c125 int,c126 int,c127 int,c128 int,primary key(c1)) engine=ndb;drop table t1;create table t1 (a1234567890123456789012345678901234567890 int primary key,a12345678901234567890123456789a1234567890 int,index(a12345678901234567890123456789a1234567890)) engine=ndb;show tables;Tables_in_testt1insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);explain select * from t1 where a12345678901234567890123456789a1234567890=2;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const 10 Using whereselect * from t1 where a12345678901234567890123456789a1234567890=2;a1234567890123456789012345678901234567890 a12345678901234567890123456789a12345678905 2drop table t1;create table t1(a bigint, b bigint, c bigint, d bigint, primary key (a,b,c,d)) engine=ndbmax_rows=800000000;Warnings:Warning 1105 Ndb might have problems storing the max amount of rows specifiedinsert into t1 values(1,2,3,4),(2,3,4,5),(3,4,5,6),(3,2,3,4),(1,3,4,5),(2,4,5,6),(1,2,3,5),(2,3,4,8),(3,4,5,9),(3,2,3,5),(1,3,4,8),(2,4,5,9),(1,2,3,6),(2,3,4,6),(3,4,5,7),(3,2,3,6),(1,3,4,6),(2,4,5,7),(1,2,3,7),(2,3,4,7),(3,4,5,8),(3,2,3,7),(1,3,4,7),(2,4,5,8),(1,3,3,4),(2,4,4,5),(3,5,5,6),(3,3,3,4),(1,4,4,5),(2,5,5,6),(1,3,3,5),(2,4,4,8),(3,5,5,9),(3,3,3,5),(1,4,4,8),(2,5,5,9),(1,3,3,6),(2,4,4,6),(3,5,5,7),(3,3,3,6),(1,4,4,6),(2,5,5,7),(1,3,3,7),(2,4,4,7),(3,5,5,8),(3,3,3,7),(1,4,4,7),(2,5,5,8);select count(*) from t1;count(*)48drop table t1;create table t1(a bigint, b bigint, c bigint, d bigint, primary key (a)) engine=ndbmax_rows=1;drop table t1;create table t1(counter int(64) NOT NULL auto_increment,datavalue char(40) default 'XXXX',primary key (counter)) ENGINE=ndbcluster;insert into t1 (datavalue) values ('newval');insert into t1 (datavalue) values ('newval');select * from t1 order by counter;counter datavalue1 newval2 newvalinsert into t1 (datavalue) select datavalue from t1 where counter < 100;insert into t1 (datavalue) select datavalue from t1 where counter < 100;select * from t1 order by counter;counter datavalue1 newval2 newval3 newval4 newval5 newval6 newval7 newval8 newvalinsert into t1 (datavalue) select datavalue from t1 where counter < 100;insert into t1 (datavalue) select datavalue from t1 where counter < 100;select * from t1 order by counter;counter datavalue1 newval2 newval3 newval4 newval5 newval6 newval7 newval8 newval35 newval36 newval37 newval38 newval39 newval40 newval41 newval42 newval43 newval44 newval45 newval46 newval47 newval48 newval49 newval50 newval51 newval52 newval53 newval54 newval55 newval56 newval57 newval58 newvaldrop table t1;create table t1 (a int primary key auto_increment) engine = ndb;insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();insert into t1(a) values (20),(28);insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();insert into t1() values (21), (22);drop table t1;CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;select * from t1;bdrop table t1;create table t1 (a int) engine=ndb;create table t2 (a int) engine=ndb;insert into t1 values (1);insert into t2 values (1);delete t1.* from t1, t2 where t1.a = t2.a;select * from t1;aselect * from t2;a1drop table t1;drop table t2;CREATE TABLE t1 (i INT,j INT,x INT,y INT,z INT) engine=ndb;CREATE TABLE t2 (i INT,k INT,x INT,y INT,z INT) engine=ndb;CREATE TABLE t3 (j INT,k INT,x INT,y INT,z INT) engine=ndb;INSERT INTO t1 VALUES ( 1, 2,13,14,15);INSERT INTO t2 VALUES ( 1, 3,23,24,25);INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);UPDATE t1 AS aINNER JOIN t2 AS bON a.i = b.iINNER JOIN t3 AS cON a.j = c.j AND b.k = c.kSET a.x = b.x,a.y = b.y,a.z = (SELECT sum(z)FROM t3WHERE y = 34)WHERE b.x = 23;select * from t1;i j x y z1 2 23 24 71drop table t1;drop table t2;drop table t3;create table atablewithareallylongandirritatingname (a int);insert into atablewithareallylongandirritatingname values (2);select * from atablewithareallylongandirritatingname;a2drop table atablewithareallylongandirritatingname;create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB;insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);select * from t1 order by f1;f1 f2 f3111111 aaaaaa 1222222 bbbbbb 2select * from t1 order by f2;f1 f2 f3111111 aaaaaa 1222222 bbbbbb 2select * from t1 order by f3;f1 f2 f3111111 aaaaaa 1222222 bbbbbb 2drop table t1;Illegal ndb error code: 1186CREATE TABLE t1 (a VARBINARY(40) NOT NULL,b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,c VARCHAR(256) CHARACTER SET UTF8 NOT NULL,PRIMARY KEY (b,c)) ENGINE=ndbcluster;INSERT INTO t1 VALUES("a","ab","abc"),("b","abc","abcd"),("c","abc","ab"),("d","ab","ab"),("e","abc","abc");SELECT * FROM t1 ORDER BY a;a b ca ab abcb abc abcdc abc abd ab abe abc abcDROP TABLE t1;create table t1 (a int not null primary key, b int not null) engine=ndb;create table t2 (a int not null primary key, b int not null) engine=ndb;insert into t1 values (1,10), (2,20), (3,30);insert into t2 values (1,10), (2,20), (3,30);select * from t1 order by a;a b1 102 203 30delete from t1 where a > 0 order by a desc limit 1;select * from t1 order by a;a b1 102 20delete from t1,t2 using t1,t2 where t1.a = t2.a;select * from t2 order by a;a b3 30drop table t1,t2;create table t1 (a int not null primary key, b int not null) engine=ndb;insert into t1 values (1,10), (2,20), (3,30);insert into t1 set a=1, b=100;ERROR 23000: Duplicate entry '1' for key 1insert ignore into t1 set a=1, b=100;select * from t1 order by a;a b1 102 203 30insert into t1 set a=1, b=1000 on duplicate key update b=b+1;select * from t1 order by a;a b1 112 203 30drop table t1;create table t1 (a int not null primary key, b int not null) engine=ndb;create table t2 (c int not null primary key, d int not null) engine=ndb;insert into t1 values (1,10), (2,10), (3,30), (4, 30);insert into t2 values (1,10), (2,10), (3,30), (4, 30);update t1 set a = 1 where a = 3;ERROR 23000: Duplicate entry '1' for key 1select * from t1 order by a;a b1 102 103 304 30update t1 set b = 1 where a > 1 order by a desc limit 1;select * from t1 order by a;a b1 102 103 304 1update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;ERROR 23000: Duplicate entry '1' for key 1select * from t1 order by a;a b1 102 103 304 1update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;select * from t1 order by a;a b1 102 103 304 1drop table t1,t2;End of 5.0 tests
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?