📄 ps_7ndb.result
字号:
use test;drop table if exists t1, t9 ;create table t1(a int, b varchar(30),primary key(a)) engine = 'NDB' ;create table t9 (c1 tinyint, c2 smallint, c3 mediumint, c4 int,c5 integer, c6 bigint, c7 float, c8 double,c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),c13 date, c14 datetime, c15 timestamp, c16 time,c17 year, c18 tinyint, c19 bool, c20 char,c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,c25 blob, c26 text, c27 mediumblob, c28 mediumtext,c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),c32 set('monday', 'tuesday', 'wednesday'),primary key(c1)) engine = 'NDB' ;delete from t1 ;insert into t1 values (1,'one');insert into t1 values (2,'two');insert into t1 values (3,'three');insert into t1 values (4,'four');commit ;delete from t9 ;insert into t9set c1= 1, c2= 1, c3= 1, c4= 1, c5= 1, c6= 1, c7= 1, c8= 1, c9= 1,c10= 1, c11= 1, c12 = 1,c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',c16= '11:11:11', c17= '2004',c18= 1, c19=true, c20= 'a', c21= '123456789a', c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',c29= 'longblob', c30= 'longtext', c31='one', c32= 'monday';insert into t9set c1= 9, c2= 9, c3= 9, c4= 9, c5= 9, c6= 9, c7= 9, c8= 9, c9= 9,c10= 9, c11= 9, c12 = 9,c13= '2004-02-29', c14= '2004-02-29 11:11:11', c15= '2004-02-29 11:11:11',c16= '11:11:11', c17= '2004',c18= 1, c19=false, c20= 'a', c21= '123456789a', c22= '123456789a123456789b123456789c', c23= 'tinyblob', c24= 'tinytext',c25= 'blob', c26= 'text', c27= 'mediumblob', c28= 'mediumtext',c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';commit ;test_sequence------ simple select tests ------prepare stmt1 from ' select * from t9 order by c1 ' ;execute stmt1;Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnrdef test t9 t9 c1 c1 1 4 1 N 49155 0 63def test t9 t9 c2 c2 2 6 1 Y 32768 0 63def test t9 t9 c3 c3 9 9 1 Y 32768 0 63def test t9 t9 c4 c4 3 11 1 Y 32768 0 63def test t9 t9 c5 c5 3 11 1 Y 32768 0 63def test t9 t9 c6 c6 8 20 1 Y 32768 0 63def test t9 t9 c7 c7 4 12 1 Y 32768 31 63def test t9 t9 c8 c8 5 22 1 Y 32768 31 63def test t9 t9 c9 c9 5 22 1 Y 32768 31 63def test t9 t9 c10 c10 5 22 1 Y 32768 31 63def test t9 t9 c11 c11 246 9 6 Y 0 4 63def test t9 t9 c12 c12 246 10 6 Y 0 4 63def test t9 t9 c13 c13 10 10 10 Y 128 0 63def test t9 t9 c14 c14 12 19 19 Y 128 0 63def test t9 t9 c15 c15 7 19 19 N 1249 0 63def test t9 t9 c16 c16 11 8 8 Y 128 0 63def test t9 t9 c17 c17 13 4 4 Y 32864 0 63def test t9 t9 c18 c18 1 4 1 Y 32768 0 63def test t9 t9 c19 c19 1 1 1 Y 32768 0 63def test t9 t9 c20 c20 254 1 1 Y 0 0 8def test t9 t9 c21 c21 254 10 10 Y 0 0 8def test t9 t9 c22 c22 253 30 30 Y 0 0 8def test t9 t9 c23 c23 252 255 8 Y 144 0 63def test t9 t9 c24 c24 252 255 8 Y 16 0 8def test t9 t9 c25 c25 252 65535 4 Y 144 0 63def test t9 t9 c26 c26 252 65535 4 Y 16 0 8def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8def test t9 t9 c29 c29 252 4294967295 8 Y 144 0 63def test t9 t9 c30 c30 252 4294967295 8 Y 16 0 8def test t9 t9 c31 c31 254 5 3 Y 256 0 8def test t9 t9 c32 c32 254 24 7 Y 2048 0 8c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c321 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesdayset @arg00='SELECT' ;@arg00 a from t1 where a=1;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 '@arg00 a from t1 where a=1' at line 1prepare stmt1 from ' ? a from t1 where a=1 ';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 '? a from t1 where a=1' at line 1set @arg00=1 ;select @arg00, b from t1 where a=1 ;@arg00 b1 oneprepare stmt1 from ' select ?, b from t1 where a=1 ' ;execute stmt1 using @arg00 ;? b1 oneset @arg00='lion' ;select @arg00, b from t1 where a=1 ;@arg00 blion oneprepare stmt1 from ' select ?, b from t1 where a=1 ' ;execute stmt1 using @arg00 ;? blion oneset @arg00=NULL ;select @arg00, b from t1 where a=1 ;@arg00 bNULL oneprepare stmt1 from ' select ?, b from t1 where a=1 ' ;execute stmt1 using @arg00 ;? bNULL oneset @arg00=1 ;select b, a - @arg00 from t1 where a=1 ;b a - @arg00one 0prepare stmt1 from ' select b, a - ? from t1 where a=1 ' ;execute stmt1 using @arg00 ;b a - ?one 0set @arg00=null ;select @arg00 as my_col ;my_colNULLprepare stmt1 from ' select ? as my_col';execute stmt1 using @arg00 ;my_colNULLselect @arg00 + 1 as my_col ;my_colNULLprepare stmt1 from ' select ? + 1 as my_col';execute stmt1 using @arg00 ;my_colNULLselect 1 + @arg00 as my_col ;my_colNULLprepare stmt1 from ' select 1 + ? as my_col';execute stmt1 using @arg00 ;my_colNULLset @arg00='MySQL' ;select substr(@arg00,1,2) from t1 where a=1 ;substr(@arg00,1,2)Myprepare stmt1 from ' select substr(?,1,2) from t1 where a=1 ' ;execute stmt1 using @arg00 ;substr(?,1,2)Myset @arg00=3 ;select substr('MySQL',@arg00,5) from t1 where a=1 ;substr('MySQL',@arg00,5)SQLprepare stmt1 from ' select substr(''MySQL'',?,5) from t1 where a=1 ' ;execute stmt1 using @arg00 ;substr('MySQL',?,5)SQLselect substr('MySQL',1,@arg00) from t1 where a=1 ;substr('MySQL',1,@arg00)MySprepare stmt1 from ' select substr(''MySQL'',1,?) from t1 where a=1 ' ;execute stmt1 using @arg00 ;substr('MySQL',1,?)MySset @arg00='MySQL' ;select a , concat(@arg00,b) from t1 order by a;a concat(@arg00,b)1 MySQLone2 MySQLtwo3 MySQLthree4 MySQLfourprepare stmt1 from ' select a , concat(?,b) from t1 order by a ' ;execute stmt1 using @arg00;a concat(?,b)1 MySQLone2 MySQLtwo3 MySQLthree4 MySQLfourselect a , concat(b,@arg00) from t1 order by a ;a concat(b,@arg00)1 oneMySQL2 twoMySQL3 threeMySQL4 fourMySQLprepare stmt1 from ' select a , concat(b,?) from t1 order by a ' ;execute stmt1 using @arg00;a concat(b,?)1 oneMySQL2 twoMySQL3 threeMySQL4 fourMySQLset @arg00='MySQL' ;select group_concat(@arg00,b order by a) from t1 group by 'a' ;group_concat(@arg00,b order by a)MySQLone,MySQLtwo,MySQLthree,MySQLfourprepare stmt1 from ' select group_concat(?,b order by a) from t1group by ''a'' ' ;execute stmt1 using @arg00;group_concat(?,b order by a)MySQLone,MySQLtwo,MySQLthree,MySQLfourselect group_concat(b,@arg00 order by a) from t1 group by 'a' ;group_concat(b,@arg00 order by a)oneMySQL,twoMySQL,threeMySQL,fourMySQLprepare stmt1 from ' select group_concat(b,? order by a) from t1group by ''a'' ' ;execute stmt1 using @arg00;group_concat(b,? order by a)oneMySQL,twoMySQL,threeMySQL,fourMySQLset @arg00='first' ;set @arg01='second' ;set @arg02=NULL;select @arg00, @arg01 from t1 where a=1 ;@arg00 @arg01first secondprepare stmt1 from ' select ?, ? from t1 where a=1 ' ;execute stmt1 using @arg00, @arg01 ;? ?first secondexecute stmt1 using @arg02, @arg01 ;? ?NULL secondexecute stmt1 using @arg00, @arg02 ;? ?first NULLexecute stmt1 using @arg02, @arg02 ;? ?NULL NULLdrop table if exists t5 ;create table t5 (id1 int(11) not null default '0',value2 varchar(100), value1 varchar(100)) ;insert into t5 values (1,'hh','hh'),(2,'hh','hh'),(1,'ii','ii'),(2,'ii','ii') ;prepare stmt1 from ' select id1,value1 from t5 where id1=? or value1=? order by id1,value1 ' ;set @arg00=1 ;set @arg01='hh' ;execute stmt1 using @arg00, @arg01 ;id1 value11 hh1 ii2 hhdrop table t5 ;drop table if exists t5 ;create table t5(session_id char(9) not null) ;insert into t5 values ('abc') ;prepare stmt1 from ' select * from t5where ?=''1111'' and session_id = ''abc'' ' ;set @arg00='abc' ;execute stmt1 using @arg00 ;session_idset @arg00='1111' ;execute stmt1 using @arg00 ;session_idabcset @arg00='abc' ;execute stmt1 using @arg00 ;session_iddrop table t5 ;set @arg00='FROM' ;select a @arg00 t1 where a=1 ;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 '@arg00 t1 where a=1' at line 1prepare stmt1 from ' select a ? t1 where a=1 ' ;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 '? t1 where a=1' at line 1set @arg00='t1' ;select a from @arg00 where a=1 ;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 '@arg00 where a=1' at line 1prepare stmt1 from ' select a from ? where a=1 ' ;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 '? where a=1' at line 1set @arg00='WHERE' ;select a from t1 @arg00 a=1 ;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 '@arg00 a=1' at line 1prepare stmt1 from ' select a from t1 ? a=1 ' ;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 '? a=1' at line 1set @arg00=1 ;select a FROM t1 where a=@arg00 ;a1prepare stmt1 from ' select a FROM t1 where a=? ' ;execute stmt1 using @arg00 ;a1set @arg00=1000 ;execute stmt1 using @arg00 ;aset @arg00=NULL ;select a FROM t1 where a=@arg00 ;aprepare stmt1 from ' select a FROM t1 where a=? ' ;execute stmt1 using @arg00 ;aset @arg00=4 ;select a FROM t1 where a=sqrt(@arg00) ;a2prepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;execute stmt1 using @arg00 ;a2set @arg00=NULL ;select a FROM t1 where a=sqrt(@arg00) ;aprepare stmt1 from ' select a FROM t1 where a=sqrt(?) ' ;execute stmt1 using @arg00 ;aset @arg00=2 ;set @arg01=3 ;select a FROM t1 where a in (@arg00,@arg01) order by a;a23prepare stmt1 from ' select a FROM t1 where a in (?,?) order by a ';execute stmt1 using @arg00, @arg01;a23set @arg00= 'one' ;set @arg01= 'two' ;set @arg02= 'five' ;prepare stmt1 from ' select b FROM t1 where b in (?,?,?) order by b ' ;execute stmt1 using @arg00, @arg01, @arg02 ;bonetwoprepare stmt1 from ' select b FROM t1 where b like ? ';set @arg00='two' ;execute stmt1 using @arg00 ;btwoset @arg00='tw%' ;execute stmt1 using @arg00 ;btwoset @arg00='%wo' ;execute stmt1 using @arg00 ;btwoset @arg00=null ;insert into t9 set c1= 0, c5 = NULL ;select c5 from t9 where c5 > NULL ;c5prepare stmt1 from ' select c5 from t9 where c5 > ? ';execute stmt1 using @arg00 ;c5select c5 from t9 where c5 < NULL ;c5prepare stmt1 from ' select c5 from t9 where c5 < ? ';execute stmt1 using @arg00 ;c5select c5 from t9 where c5 = NULL ;c5prepare stmt1 from ' select c5 from t9 where c5 = ? ';execute stmt1 using @arg00 ;c5select c5 from t9 where c5 <=> NULL ;c5NULLprepare stmt1 from ' select c5 from t9 where c5 <=> ? ';execute stmt1 using @arg00 ;c5NULLdelete from t9 where c1= 0 ;set @arg00='>' ;select a FROM t1 where a @arg00 1 ;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 '@arg00 1' at line 1prepare stmt1 from ' select a FROM t1 where a ? 1 ' ;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 '? 1' at line 1set @arg00=1 ;select a,b FROM t1 where a is not NULLAND b is not NULL group by a - @arg00 ;a b1 one2 two3 three4 fourprepare stmt1 from ' select a,b FROM t1 where a is not NULLAND b is not NULL group by a - ? ' ;execute stmt1 using @arg00 ;a b1 one2 two3 three4 fourset @arg00='two' ;select a,b FROM t1 where a is not NULLAND b is not NULL having b <> @arg00 order by a ;a b1 one3 three4 fourprepare stmt1 from ' select a,b FROM t1 where a is not NULLAND b is not NULL having b <> ? order by a ' ;execute stmt1 using @arg00 ;a b1 one3 three4 fourset @arg00=1 ;select a,b FROM t1 where a is not NULLAND b is not NULL order by a - @arg00 ;a b1 one2 two3 three4 fourprepare stmt1 from ' select a,b FROM t1 where a is not NULLAND b is not NULL order by a - ? ' ;execute stmt1 using @arg00 ;a b1 one2 two3 three4 fourset @arg00=2 ;select a,b from t1 order by 2 ;a b4 four
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -