Skip to content

Commit

Permalink
init the project
Browse files Browse the repository at this point in the history
  • Loading branch information
aressu1985 committed May 19, 2022
1 parent 554e3f6 commit 501ac64
Show file tree
Hide file tree
Showing 89 changed files with 6,309 additions and 0 deletions.
40 changes: 40 additions & 0 deletions assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>test</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
<outputDirectory>./lib</outputDirectory>
<fileMode>755</fileMode>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>./</directory>
<filtered>true</filtered>
<includes>
<include>mo.yml</include>
<include>run.yml</include>
<include>log4j.properties</include>
</includes>
<fileMode>755</fileMode>
<outputDirectory>./</outputDirectory>
</fileSet>
<fileSet>
<directory>./</directory>
<includes>
<include>run.sh</include>
</includes>
<fileMode>755</fileMode>
<outputDirectory>./</outputDirectory>
</fileSet>
</fileSets>

</assembly>
268 changes: 268 additions & 0 deletions cases/builtin.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
drop table if exists t1;
create table t1(a int,b int);
insert into t1 values(5,-2),(10,3),(100,0),(4,3),(6,-3);
select power(a,b) from t1;
select power(a,2) as a1, power(b,2) as b1 from t1 where power(a,2) > power(b,2) order by a1 asc;
drop table if exists t1;
create table t1(a date,b datetime);
insert into t1 values("2022-06-01","2022-07-01 00:00:00");
insert into t1 values("2022-12-31","2011-01-31 12:00:00");
select month(a),month(b) from t1;
select * from t1 where month(a)>month(b);
select * from t1 where month(a) between 1 and 6;
drop table if exists t1;
create table t1(a varchar(12),c char(30));
insert into t1 values('sdfad ','2022-02-02 22:22:22');
insert into t1 values(' sdfad ','2022-02-02 22:22:22');
insert into t1 values('adsf sdfad','2022-02-02 22:22:22');
insert into t1 values(' sdfad','2022-02-02 22:22:22');
select reverse(a),reverse(c) from t1;
select a from t1 where reverse(a) like 'daf%';
select reverse(a) reversea,reverse(reverse(a)) normala from t1;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0),(-15,-20),(-22,-12.5);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select acos(a*pi()/180) as acosa,acos(b*pi()/180) acosb from t1;
select acos(a*pi()/180)*acos(b*pi()/180) as acosab,acos(acos(a*pi()/180)) as c from t1;
select b from t1 where acos(a*pi()/180)<=acos(b*pi()/180) order by a;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0),(-15,-20),(-22,-12.5);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select atan(a*pi()/180) as atana,atan(b*pi()/180) atanb from t1;
select atan(a*pi()/180)*atan(b*pi()/180) as atanab,atan(atan(a*pi()/180)) as c from t1;
select b from t1 where atan(a*pi()/180)<=atan(b*pi()/180) order by a;
drop table if exists t1;
CREATE TABLE t1(
Employee_Name VARCHAR(100) NOT NULL,
Working_At VARCHAR(20) NOT NULL,
Work_Location VARCHAR(20) NOT NULL,
Joining_Date DATE NOT NULL,
Annual_Income INT NOT NULL);
INSERT INTO t1
VALUES
('Amit Khan', 'XYZ Digital', 'Kolkata', '2019-10-06', 350000),
('Shreetama Pal', 'ABC Corp.', 'Kolkata', '2018-12-16', 500000),
('Aniket Sharma', 'PQR Soln.', 'Delhi', '2020-01-11', 300000),
('Maitree Jana', 'XYZ Digital', 'Kolkata', '2019-05-01', 400000),
('Priyanka Ojha', 'ABC Corp.', 'Delhi', '2019-02-13', 350000),
('Sayani Mitra', 'XYZ Digital', 'Kolkata', '2019-09-15', 320000),
('Nitin Dey', 'PQR Soln.', 'Delhi', '2019-10-06', 250000),
('Sujata Samanta', 'PQR Soln.', 'Kolkata', '2020-10-06', 350000),
('Sudip Majhi', 'ABC Corp.', 'Delhi', '2018-10-30', 600000),
('Sanjoy Kohli', 'XYZ Digital', 'Delhi', '2019-04-18', 450000);
SELECT Working_At, BIT_AND(Annual_Income) AS BITORINCOME FROM t1 group by Working_At;
SELECT Work_Location, BIT_AND(Annual_Income) AS BITORINCOME FROM t1 Group By Work_Location;
drop table if exists t1;
CREATE TABLE t1(
Employee_Name VARCHAR(100) NOT NULL,
Working_At VARCHAR(20) NOT NULL,
Work_Location VARCHAR(20) NOT NULL,
Joining_Date DATE NOT NULL,
Annual_Income INT NOT NULL);
INSERT INTO t1
VALUES
('Amit Khan', 'XYZ Digital', 'Kolkata', '2019-10-06', 350000),
('Shreetama Pal', 'ABC Corp.', 'Kolkata', '2018-12-16', 500000),
('Aniket Sharma', 'PQR Soln.', 'Delhi', '2020-01-11', 300000),
('Maitree Jana', 'XYZ Digital', 'Kolkata', '2019-05-01', 400000),
('Priyanka Ojha', 'ABC Corp.', 'Delhi', '2019-02-13', 350000),
('Sayani Mitra', 'XYZ Digital', 'Kolkata', '2019-09-15', 320000),
('Nitin Dey', 'PQR Soln.', 'Delhi', '2019-10-06', 250000),
('Sujata Samanta', 'PQR Soln.', 'Kolkata', '2020-10-06', 350000),
('Sudip Majhi', 'ABC Corp.', 'Delhi', '2018-10-30', 600000),
('Sanjoy Kohli', 'XYZ Digital', 'Delhi', '2019-04-18', 450000);
SELECT Work_Location, BIT_AND(Annual_Income) AS BITORINCOME FROM t1 Group By Work_Location;
SELECT Working_At, BIT_AND(Annual_Income) AS BITORINCOME FROM t1 group by Working_At;
drop table if exists t1;
CREATE TABLE t1(
Employee_Name VARCHAR(100) NOT NULL,
Working_At VARCHAR(20) NOT NULL,
Work_Location VARCHAR(20) NOT NULL,
Joining_Date DATE NOT NULL,
Annual_Income INT NOT NULL);
INSERT INTO t1
VALUES
('Amit Khan', 'XYZ Digital', 'Kolkata', '2019-10-06', 350000),
('Shreetama Pal', 'ABC Corp.', 'Kolkata', '2018-12-16', 500000),
('Aniket Sharma', 'PQR Soln.', 'Delhi', '2020-01-11', 300000),
('Maitree Jana', 'XYZ Digital', 'Kolkata', '2019-05-01', 400000),
('Priyanka Ojha', 'ABC Corp.', 'Delhi', '2019-02-13', 350000),
('Sayani Mitra', 'XYZ Digital', 'Kolkata', '2019-09-15', 320000),
('Nitin Dey', 'PQR Soln.', 'Delhi', '2019-10-06', 250000),
('Sujata Samanta', 'PQR Soln.', 'Kolkata', '2020-10-06', 350000),
('Sudip Majhi', 'ABC Corp.', 'Delhi', '2018-10-30', 600000),
('Sanjoy Kohli', 'XYZ Digital', 'Delhi', '2019-04-18', 450000);
SELECT Work_Location, BIT_XOR(Annual_Income) AS BITORINCOME FROM t1 Group By Work_Location;
SELECT Working_At, BIT_XOR(Annual_Income) AS BITORINCOME FROM t1 group by Working_At;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select cos(a),cos(b) from t1;
select cos(a)*cos(b),cos(cos(a)) as c from t1;
select distinct a from t1 where cos(a)<=cos(b) order by a desc;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0),(-15,-20),(-22,-12.5);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select cot(a*pi()/180) as cota,cot(b*pi()/180) cotb from t1;
select cot(a*pi()/180)*cot(b*pi()/180) as cotab,cot(cot(a*pi()/180)) as c from t1;
select b from t1 where cot(a*pi()/180)<=cot(b*pi()/180) order by a;
drop table if exists t1;
create table t1(a date, b datetime,c varchar(30));
insert into t1 values('2022-01-01','2022-01-01 01:01:01','2022-01-01 01:01:01');
insert into t1 values('2022-01-01','2022-01-01 01:01:01','2022-01-01 01:01:01');
insert into t1 values(20220101,'2022-01-01 01:01:01','2022-13-13 01:01:01');
insert into t1 values('2022-01-02','2022-01-02 23:01:01','2022-01-01 23:01:01');
insert into t1 values('2021-12-31','2021-12-30 23:59:59','2021-12-30 23:59:59');
insert into t1 values('2022-06-30','2021-12-30 23:59:59','2021-12-30 23:59:59');
select distinct dayofyear(a) as dya from t1;
select * from t1 where dayofyear(a)>120;
select * from t1 where dayofyear(a) between 1 and 184;
drop table if exists t1;
CREATE TABLE t1(a INT,b VARCHAR(100),c CHAR(20));
INSERT INTO t1
VALUES
(1,'Ananya Majumdar', 'XI'),
(2,'Anushka Samanta', 'X'),
(3,'Aniket Sharma', 'XI'),
(4,'Anik Das', 'X'),
(5,'Riya Jain', 'IX'),
(6,'Tapan Samanta', 'XI');
select a,endswith(b,'a') from t1;
select a,b,c from t1 where endswith(b,'a')=1 and endswith(c,'I')=1;
drop table if exists t1;
CREATE TABLE t1(Student_id INT,Student_name VARCHAR(100),Student_Class CHAR(20));
INSERT INTO t1
VALUES
(1,'Ananya Majumdar', 'IX'),
(2,'Anushka Samanta', 'X'),
(3,'Aniket Sharma', 'XI'),
(4,'Anik Das', 'X'),
(5,'Riya Jain', 'IX'),
(6,'Tapan Samanta', 'X');
SELECT Student_id, Student_name,LPAD(Student_Class, 10, ' _') AS LeftPaddedString FROM t1;
SELECT Student_id, lpad(Student_name,4,'new') AS LeftPaddedString FROM t1;
SELECT Student_id, lpad(Student_name,-4,'new') AS LeftPaddedString FROM t1;
SELECT Student_id, lpad(Student_name,0,'new') AS LeftPaddedString FROM t1;
drop table if exists t1;
CREATE TABLE t1(Student_id INT,Student_name VARCHAR(100),Student_Class CHAR(20));
INSERT INTO t1
VALUES
(1,'Ananya Majumdar', 'IX'),
(2,'Anushka Samanta', 'X'),
(3,'Aniket Sharma', 'XI'),
(4,'Anik Das', 'X'),
(5,'Riya Jain', 'IX'),
(6,'Tapan Samanta', 'X');
SELECT Student_id, Student_name,RPAD(Student_Class, 10, ' _') AS LeftPaddedString FROM t1;
SELECT Student_id, rpad(Student_name,4,'new') AS LeftPaddedString FROM t1;
SELECT Student_id, rpad(Student_name,-4,'new') AS LeftPaddedString FROM t1;
SELECT Student_id, rpad(Student_name,0,'new') AS LeftPaddedString FROM t1;
drop table if exists t1;
CREATE TABLE t1
(
Employee_name VARCHAR(100) NOT NULL,
Joining_Date DATE NOT NULL
);
INSERT INTO t1
(Employee_name, Joining_Date )
VALUES
(' Ananya Majumdar', '2000-01-11'),
(' Anushka Samanta', '2002-11-10' ),
(' Aniket Sharma ', '2005-06-11' ),
(' Anik Das', '2008-01-21' ),
(' Riya Jain', '2008-02-01' ),
(' Tapan Samanta', '2010-01-11' ),
(' Deepak Sharma', '2014-12-01' ),
(' Ankana Jana', '2018-08-17'),
(' Shreya Ghosh', '2020-09-10') ;
SELECT LTRIM( Employee_name) LTrimName,RTRIM(Employee_name) AS RTrimName FROM t1 order by RTrimName desc;
SELECT LTRIM(RTRIM(Employee_name)) as TrimName from t1 where Employee_name like '%Ani%' order by TrimName asc;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select sin(a),sin(b) from t1;
select sin(a)*sin(b),sin(sin(a)) as c from t1;
select distinct a from t1 where sin(a)<=sin(b) order by a desc;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0),(-15,-20),(-22,-12.5);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select sinh(a*pi()/180) as sinha,sinh(b*pi()/180) sinhb from t1;
select sinh(a*pi()/180)*sinh(b*pi()/180) as sinhab,sinh(sinh(a*pi()/180)) as c from t1;
select b from t1 where sinh(a*pi()/180)<=sinh(b*pi()/180) order by a;
drop table if exists t1;
CREATE TABLE t1
(
Employee_name VARCHAR(100) NOT NULL,
Joining_Date DATE NOT NULL
);
INSERT INTO t1
(Employee_name, Joining_Date )
VALUES
(' Ananya Majumdar', '2000-01-11'),
(' Anushka Samanta', '2002-11-10' ),
(' Aniket Sharma ', '2005-06-11' ),
(' Anik Das', '2008-01-21' ),
(' Riya Jain', '2008-02-01' ),
(' Tapan Samanta', '2010-01-11' ),
(' Deepak Sharma', '2014-12-01' ),
(' Ankana Jana', '2018-08-17'),
(' Shreya Ghosh', '2020-09-10') ;
INSERT INTO t1
(Employee_name, Joining_Date ) values(' ','2014-12-01');
select * from t1 where Employee_name=space(5);
drop table if exists t1;
CREATE TABLE t1(a INT,b VARCHAR(100),c CHAR(20));
INSERT INTO t1
VALUES
(1,'Ananya Majumdar', 'IX'),
(2,'Anushka Samanta', 'X'),
(3,'Aniket Sharma', 'XI'),
(4,'Anik Das', 'X'),
(5,'Riya Jain', 'IX'),
(6,'Tapan Samanta', 'X');
select a,startswith(b,'An') from t1;
select a,b,c from t1 where startswith(b,'An')=1 and startswith(c,'I')=1;
drop table if exists t1;
CREATE TABLE t1(PlayerName VARCHAR(100) NOT NULL,RunScored INT NOT NULL,WicketsTaken INT NOT NULL);
INSERT INTO t1 VALUES('KL Rahul', 52, 0 ),('Hardik Pandya', 30, 1 ),('Ravindra Jadeja', 18, 2 ),('Washington Sundar', 10, 1),('D Chahar', 11, 2 ), ('Mitchell Starc', 0, 3);
SELECT STDDEV_POP(RunScored) as Pop_Standard_Deviation FROM t1;
SELECT STDDEV_POP(WicketsTaken) as Pop_Std_Dev_Wickets FROM t1;
drop table if exists t1;
create table t1(a int,b float);
insert into t1 values(0,0),(-15,-20),(-22,-12.5);
insert into t1 values(0,360),(30,390),(90,450),(180,270),(180,180);
select tan(a*pi()/180) as tana,tan(b*pi()/180) tanb from t1;
select tan(a*pi()/180)*tan(b*pi()/180) as tanab,tan(tan(a*pi()/180)) as c from t1;
select b from t1 where tan(a*pi()/180)<=tan(b*pi()/180) order by a;
drop table if exists t1;
create table t1(a date,b datetime);
insert into t1 values("2022-06-01","2022-07-01 00:00:00");
insert into t1 values("2022-12-31","2011-01-31 12:00:00");
insert into t1 values("2022-06-12","2022-07-01 00:00:00");
select a,weekday(a),b,weekday(b) from t1;
select * from t1 where weekday(a)>weekday(b);
select * from t1 where weekday(a) between 0 and 4;
drop table if exists t1;
create table t1(a date,b datetime);
insert into t1 values("2022-06-01","2022-07-01 00:00:00");
insert into t1 values("2022-12-31","2011-01-31 12:00:00");
insert into t1 values("2022-06-12","2022-07-01 00:00:00");
select a,weekday(a),b,weekday(b) from t1;
select * from t1 where weekday(a)>weekday(b);
select * from t1 where weekday(a) between 0 and 4;
drop table if exists t1;
create table t1(a date, b datetime);
insert into t1 values('2022-01-01','2022-01-01 01:01:01');
insert into t1 values('2022-01-01','2022-01-01 01:01:01');
insert into t1 values(20220101,'2022-01-01 01:01:01');
insert into t1 values('2022-01-02','2022-01-02 23:01:01');
insert into t1 values('2021-12-31','2021-12-30 23:59:59');
insert into t1 values('2022-06-30','2021-12-30 23:59:59');
select date(a),date(b) from t1;
select date(a),date(date(a)) as dda from t1;
19 changes: 19 additions & 0 deletions cases/create_database.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
drop database if exists test01;
drop database if exists test03;
drop database if exists test04;
drop database if exists test05;
drop database if exists `测试数据库`;
drop database if exists t01234567890123456789012345678901234567890123456789012345678901234567890123456789;
create database test01;
create database IF NOT EXISTS test01;
create database `测试数据库`;
create database test03 default character set utf8 collate utf8_general_ci encryption 'Y';
create database test04 character set=utf8 collate=utf8_general_ci encryption='N';
create database t01234567890123456789012345678901234567890123456789012345678901234567890123456789;
show databases;
drop database if exists test01;
drop database if exists test03;
drop database if exists test04;
drop database if exists test05;
drop database if exists `测试数据库`;
drop database if exists t01234567890123456789012345678901234567890123456789012345678901234567890123456789;
16 changes: 16 additions & 0 deletions cases/create_table.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
create table table01(a TINYINT primary key, b SMALLINT SIGNED, c INT UNSIGNED,d BIGINT not null , e FLOAT unique,f DOUBLE, g CHAR(10), h VARCHAR(20));
create table table15 (a varchar(5) default 'abcde');
create temporary table table05 ( a int, b char(10));
create table table06 (a int primary key, b varchar(10));
create table table10 (a int primary key, b varchar(10)) checksum=0 COMMENT="asdf";
create table `测试表` (`测试1` int);
create table `table11 ` (a int);
create table table12 (`a ` int);
create table `a/a` (a int);
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
create table table14 (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
create table table16 (1a20 int,1e int);
create table $table18 (a$1 int, $b int, c$ int);
create table table19$ (a int);
create table table17 (`index` int);
show tables;
50 changes: 50 additions & 0 deletions cases/datatype.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
drop table if exists numtable;
create table numtable(id int,fl float, dl double);
insert into numtable values(1,123456,123456);
insert into numtable values(2,123.456,123.456);
insert into numtable values(3,1.234567,1.234567);
insert into numtable values(4,1.234567891,1.234567891);
insert into numtable values(5,1.2345678912345678912,1.2345678912345678912);
select id,fl,dl from numtable order by id;
drop table if exists numtable;
create table numtable(id int,fl float(5,3));
insert into numtable values(2,99);
insert into numtable values(3,99.123);
insert into numtable values(4,99.1236);
select id,fl from numtable;
drop table if exists numtable;
create table numtable(id int,fl float(23));
insert into numtable values(1,1.2345678901234567890123456789);
select id,fl from numtable;
drop table if exists numtable;
create table numtable(id int,dl double);
insert into numtable values(1,1.2345678901234567890123456789);
select id,dl from numtable;
drop table if exists numtable;
create table numtable(a tinyint unsigned, b smallint unsigned, c int unsigned, d bigint unsigned);
insert into numtable values(255,65535,4294967295,18446744073709551615);
select a,b,c,d from numtable;
drop table if exists numtable;
create table numtable(a tinyint signed, b smallint signed, c int signed, d bigint signed);
insert into numtable values(127,32767,2147483647,9223372036854775807);
insert into numtable values(-128,-32768,-2147483648,-9223372036854775808);
select a,b,c,d from numtable;
drop table if exists names;
create table names(name varchar(255),age char(255));
insert into names(name, age) values('Abby', '24');
insert into names(name, age) values("Bob", '25');
insert into names(name, age) values('Carol', "23");
insert into names(name, age) values("Dora", "29");
select name,age from names;
drop table if exists t4;
create table t4(a int, b date, c datetime);
insert into t4 values(1, '2021-12-13','2021-12-13 13:00:00');
insert into t4 values(2, '20211214','20211213');
insert into t4 values(3,'2021-12-14','2021-12-14');
insert into t4 values(4,'2021-12-15','2021-12-14');
select * from t4 where b>'20211213';
select * from t4 where c>'20211213';
select * from t4 where b>'2021-12-13';
select * from t4 where c>'2021-12-13';
select * from t4 where b between '2021-12-13' and '2021-12-14';
select * from t4 where b not between '2021-12-13' and '2021-12-14';
Loading

0 comments on commit 501ac64

Please sign in to comment.