具體語法:values row _ constructor _ list[order by column _ designer][limit by number]row _ constructor _ list:row(value _ list)[,row (value _ list)] [,...]value_list: value[,value][,...]列指示符:列索引
VALUES語句,用於展示函數或快速創建數據場景。結果列的名稱以COLUMN_0開頭,依此類推。舉個簡單的例子。單壹值語句MySQL-(YTT/3305)->;值行(1,2,3);+-+-+| column _ 0 | column _ 1 | column _ 2 |+-+-+| 1 | 2 | 3 |+-+-+-+1行插入(0.00秒)
多值語句MySQL-(YTT/3305)->;值行(1,2,3),行(10,9,8);+-+-+| column _ 0 | column _ 1 | column _ 2 |+-+-+| 1 | 2 | 3 | | 10 | 9 | 8 |+-+-++集合中的2行(0.00秒)
多個值結合union all MySQL-(YTT/3305)->;values row(1,2,3),row(10,9,8) union all values \ row(-1,-2,0),row(10,29,30),row(100,20,-9);+--+-+| column _ 0 | column _ 1 | column _ 2 |+-+-+| 1 | 2 | 3 | | 10 | 9 | 8 | |-1 |-2 | 0 | | 10 | 29 | 30 | | 100 | 20 |-9 |+-+-+-+集合中的5行(0.00秒)
按照字段下標的順序,MySQL-(YTT/3305)->;values row(1,2,3),row(10,9,8) union所有值\ row(-1,-2,0),row(10,29,30),row(100,20,-9)order by 1 desc;+--+-+| column _ 0 | column _ 1 | column _ 2 |+-+-+| 100 | 20 |-9 | | 10 | 9 | 8 | | 10 | 29 | 30 | | 1 | 2 | 3 | |-1 |-2 | 0 |++-+-+集合中的5行(0.00秒)
類型可以任意組合:MySQL-(YTT/3305)->如bit,json,datetime,int,decimalvalues row(100,200,300),\ row(' 2020-03-10 12:14:15 ',' mysql ',' test '),\ row(16.22,TRUE,b'1 '),\ row(left(uuid(),8),' {"name":"lucy "," age ":"+--+-+| column _ 0 | column _ 1 | column _ 2 |+--+-+| 100 | 200 | 0x 333030 | | 2020-03-10 12:14:15 | MySQL | 0x 74657374 | | 16.22 | 65438
創建壹個新表t3,並將這些記錄寫入mysql-(ytt/3305)->中。創建表t3 (r1 varchar(100),r2 varchar(100),R3 varchar(100));查詢正常,0行受影響(0.02秒)
寫到表T3 MySQL-(YTT/3305)->;插入t3值行(100,200,300),\ row(' 2020-03-10 12:14:15 ',' mysql ',' test '),\ row(16.22,TRUE,b'1 '),\ row(left(uuid(),8),' {"name":"lucy "," age查詢正常,4行受影響(0.00秒)記錄:4個重復項:0個警告:0個