提交 2449c6ed 编写于 作者: wmmhello's avatar wmmhello

add rawsql the second version

上级 6737952e
drop database db;
create database db;
use db;
create table if not exists jsons1(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)
insert into jsons1_1 using jsons1 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 1, false, 'json1', '你是') (1591060608000, 23, true, '等等', 'json')
insert into jsons1_2 using jsons1 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060628000, 2, true, 'json2', 'sss')
insert into jsons1_3 using jsons1 tags('{\"tag1\":false,\"tag2\":\"beijing\"}') values (1591060668000, 3, false, 'json3', 'efwe')
insert into jsons1_4 using jsons1 tags('{\"tag1\":null,\"tag2\":\"shanghai\",\"tag3\":\"hello\"}') values (1591060728000, 4, true, 'json4', '323sd')
insert into jsons1_5 using jsons1 tags('{\"tag1\":1.232, \"tag2\":null}') values(1591060928000, 1, false, '你就会', 'ewe')
insert into jsons1_6 using jsons1 tags('{\"tag1\":11,\"tag2\":\"\",\"tag2\":null}') values(1591061628000, 11, false, '你就会','')
insert into jsons1_7 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '你就会', 'dws')
CREATE TABLE if not exists jsons1_8 using jsons1 tags('{\"tag1\":null, \"tag1\":true, \"tag1\":45, \"1tag$\":2, \" \":90}')
insert into jsons1_9 using jsons1 tags('\t') values (1591062328000, 24, NULL, '你就会', '2sdw')
CREATE TABLE if not exists jsons1_10 using jsons1 tags('')
CREATE TABLE if not exists jsons1_11 using jsons1 tags(' ')
CREATE TABLE if not exists jsons1_12 using jsons1 tags('{}')
CREATE TABLE if not exists jsons1_13 using jsons1 tags('null')
ALTER TABLE jsons1_1 SET TAG jtag='{\"tag1\":\"femail\",\"tag2\":35,\"tag3\":true}'
select dataint from jsons1
select * from jsons1
select jtag from jsons1
select jtag from jsons1 where jtag is null
select jtag from jsons1 where jtag is not null
select jtag from jsons1_8
select jtag from jsons1_1
select jtag from jsons1_9
select jtag->'tag1' from jsons1_1
select jtag->'tag2' from jsons1_6
select jtag->'tag2' from jsons1_1
select jtag->'tag3' from jsons1_1
select jtag->'tag1' from jsons1_4
select jtag->'tag1' from jsons1_5
select jtag->'tag10' from jsons1_4
#select jtag->'tag1' from jsons1
#select * from jsons1 where jtag->'tag2'='beijing'
#select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'
select * from jsons1 where jtag->'tag1'='beijing'
select * from jsons1 where jtag->'tag1'='收到货'
select * from jsons1 where jtag->'tag2'>'beijing'
select * from jsons1 where jtag->'tag2'>='beijing'
select * from jsons1 where jtag->'tag2'<'beijing'
select * from jsons1 where jtag->'tag2'<='beijing'
select * from jsons1 where jtag->'tag2'!='beijing'
select * from jsons1 where jtag->'tag2'=''
select * from jsons1 where jtag->'tag1'=5
select * from jsons1 where jtag->'tag1'=10
select * from jsons1 where jtag->'tag1'<54
select * from jsons1 where jtag->'tag1'<=11
select * from jsons1 where jtag->'tag1'>4
select * from jsons1 where jtag->'tag1'>=5
select * from jsons1 where jtag->'tag1'!=5
select * from jsons1 where jtag->'tag1'!=55
select * from jsons1 where jtag->'tag1'=1.232
select * from jsons1 where jtag->'tag1'<1.232
select * from jsons1 where jtag->'tag1'<=1.232
select * from jsons1 where jtag->'tag1'>1.23
select * from jsons1 where jtag->'tag1'>=1.232
select * from jsons1 where jtag->'tag1'!=1.232
select * from jsons1 where jtag->'tag1'!=3.232
select * from jsons1 where jtag->'tag1'=true
select * from jsons1 where jtag->'tag1'=false
select * from jsons1 where jtag->'tag1'!=false
select * from jsons1 where jtag->'tag1'=null
select * from jsons1 where jtag is null
select * from jsons1 where jtag is not null
select * from jsons1 where jtag->'tag_no_exist'=3
select * from jsons1 where jtag->'tag1' is null
select * from jsons1 where jtag->'tag4' is null
select * from jsons1 where jtag->'tag3' is not null
select * from jsons1 where jtag?'tag1'
select * from jsons1 where jtag?'tag3'
select * from jsons1 where jtag?'tag_no_exist'
select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'
select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'
select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'
select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'
select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35
select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35
select * from jsons1 where jtag->'tag1' is not null and jtag?'tag3'
select * from jsons1 where jtag->'tag1'='femail' and jtag?'tag3'
select * from jsons1 where tbname = 'jsons1_1'
select * from jsons1 where tbname = 'jsons1_1' and jtag?'tag3'
select * from jsons1 where tbname = 'jsons1_1' and jtag?'tag3' and dataint=3
select * from jsons1 where tbname = 'jsons1_1' and jtag?'tag3' and dataint=23
select *,tbname from jsons1 where jtag->'tag2' like 'bei%'
select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null
select * from jsons1 where jtag->'tag1' match 'ma'
select * from jsons1 where jtag->'tag1' match 'ma$'
select * from jsons1 where jtag->'tag2' match 'jing$'
select * from jsons1 where jtag->'tag1' match '收到'
insert into jsons1_14 using jsons1 tags('{\"tag1\":\"收到货\",\"tag2\":\"\",\"tag3\":null}') values(1591062628000, 2, NULL, '你就会', 'dws')
select distinct jtag->'tag1' from jsons1
select distinct jtag from jsons1
INSERT INTO jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"datastr\":\"是是是\"}') values(1591060828000, 4, false, 'jjsf', \"你就会\
select *,tbname,jtag from jsons1 where jtag->'datastr' match '是' and datastr match 'js'
select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'
create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)
insert into jsons2_1 using jsons2 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 2, false, 'json2', '你是2')
insert into jsons2_2 using jsons2 tags('{\"tag1\":5,\"tag2\":null}') values (1591060628000, 2, true, 'json2', 'sss')
create table if not exists jsons3(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)
insert into jsons3_1 using jsons3 tags('{\"tag1\":\"fff\",\"tag2\":5, \"tag3\":true}') values(1591060618000, 3, false, 'json3', '你是3')
insert into jsons3_2 using jsons3 tags('{\"tag1\":5,\"tag2\":\"beijing\"}') values (1591060638000, 2, true, 'json3', 'sss')
select 'sss',33,a.jtag->'tag3' from jsons2 a,jsons3 b where a.ts=b.ts and a.jtag->'tag1'=b.jtag->'tag1'
select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' desc
select count(*) from jsons1 group by jtag->'tag1' order by jtag->'tag1' asc
select stddev(dataint) from jsons1 group by jtag->'tag1'
select top(dataint,100) from jsons1 group by jtag->'tag1'
select * from (select jtag, dataint from jsons1)
select jtag->'tag1' from (select jtag->'tag1', dataint from jsons1)
select ts,tbname,jtag->'tag1' from (select jtag->'tag1',tbname,ts from jsons1 order by ts)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册