未验证 提交 87226467 编写于 作者: 羽飞's avatar 羽飞 提交者: GitHub

Merge pull request #27 from hnwyllmm/main

add test cases like mysql-test
...@@ -70,7 +70,7 @@ MESSAGE("Install target dir is " ${CMAKE_INSTALL_PREFIX}) ...@@ -70,7 +70,7 @@ MESSAGE("Install target dir is " ${CMAKE_INSTALL_PREFIX})
ADD_SUBDIRECTORY(deps) ADD_SUBDIRECTORY(deps)
ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(unitest) ADD_SUBDIRECTORY(unitest)
ADD_SUBDIRECTORY(test) ADD_SUBDIRECTORY(test/perf)
# install 准备安装的目录是cmakefile 的当前目录, 不是build 后生成的目录 # install 准备安装的目录是cmakefile 的当前目录, 不是build 后生成的目录
......
# miniob-test
miniob自动化功能测试
使用方法参考 miniob_test.py
{
"basic":{"necessary":true, "score":10},
"primary-date":{"necessary":true, "score":10},
"primary-update":{"necessary":true, "score":10},
"primary-select-meta":{"necessary":true, "score":10},
"primary-select-tables":{"necessary":true, "score":10},
"primary-aggregation-func":{"necessary":true, "score":10},
"primary-drop-table":{"necessary":true, "score":10},
"primary-insert":{"necessary":false, "score":10},
"primary-join-tables":{"necessary":false, "score":20},
"primary-null":{"necessary":false, "score":10},
"primary-unique":{"necessary":false, "score":10},
"primary-simple-sub-query":{"necessary":false, "score":10},
"primary-multi-index":{"necessary":false, "score":20},
"primary-text":{"necessary":false, "score":20},
"primary-expression":{"necessary":false, "score":20},
"primary-complex-sub-query":{"necessary":false, "score":20},
"primary-order-by":{"necessary":false, "score":10},
"primary-group-by":{"necessary":false, "score":20}
}
# -*- coding: UTF-8 -*-
from genericpath import exists
import os
import json
import http.client
import sys
import logging
import subprocess
import socket
import select
import time
import shutil
#import timeout_decorator
from enum import Enum
#import eventlet
#from timeout_decorator import TimeoutError
try:
from optparse import OptionParser
except:
print("cannot load optparse module")
exit(1)
"""
为OceanBase 大赛测试平台设计的自动化测试程序
测试流程:
获取源码 ->
编译源码 ->
获取测试用例文件 ->
启动observer ->
执行测试用例 ->
对比执行结果与预先设置的结果文件
- 获取源码的方式:支持通过git获取,也可以指定源码的zip压缩包路径
- 编译源码:可以指定编译的cmake和make参数。也可以跳过这个步骤。
- 测试用例文件:测试用例文件都以.test结尾,当前放在test目录下,分为necessary和option(后续可以考虑删除)
- 测试结果文件:预先设置的结果文件,以.result结尾,放在result目录下
- 启动observer: 启动observer,使用unix socket,这样可以每个observer使用自己的socket文件
- 执行测试用例:测试用例文件中,每行都是一个命令。命令可以是SQL语句,也可以是预先定义的命令,比如 echo,sort等
- 评分文件:当前为 case-scores.json 文件,内容为json格式,描述每个case的分值
- 测试:使用参数直接连接已经启动的observer
TODO list
- 控制所有用例一共执行的时长
- 简化部分配置项,已知:增加测试base-dir目录,在base-dir下查找test/result/case-scores.json文件
How to use:
使用git下载代码然后测试
python3 miniob_test.py \
--test-case-dir=./test \
--test-case-scores=case-scores.json \
--test-result-dir=result \
--test-result-tmp-dir=./result_tmp \
--use-unix-socket \
--git-repo=https://github.com/oceanbase/miniob.git \
--git-branch=main \
--code-type=git \
--target-dir=./miniob \
--log=stdout \
--compile-make-args=-j4
"""
class TimeoutException(BaseException):
def __init__(self, value="Timed Out"):
self.value = value
def __str__(self):
return repr(self.value)
class Result(Enum):
true = True
false = False
timeout = 0
class GlobalConfig:
default_encoding = "UTF-8"
debug = False
source_code_build_path_name = "build"
def __get_source_path(target_dir: str):
return target_dir + '/miniob'
def __get_project_path(target_dir: str):
return __get_source_path(target_dir)
def __get_data_path(target_dir: str):
return target_dir + '/data'
def __get_result_path(target_dir: str):
return target_dir + '/result'
def __get_build_path(target_dir: str):
return target_dir + '/' + GlobalConfig.source_code_build_path_name
class ResultWriter:
'''
写数据到指定文件,当前用于输出测试结果
'''
def __init__(self, file):
self.__file = file
def __exit__(self, exc_type, exc_value, exc_tb):
self.close()
def close(self):
if self.__file is not None:
self.__file.close()
self.__file = None
def write(self, arg: str):
self.__file.write(bytes(arg.upper(), GlobalConfig.default_encoding))
def write_line(self, arg: str):
self.write(str(arg).upper())
self.write('\n')
class MiniObServer:
'''
用来控制miniob的服务器程序。负责程序的启停和环境的初始化和清理工作
'''
def __init__(self, base_dir: str, data_dir: str, config_file: str, server_port: int, server_socket: str, clean_data_dir: bool):
self.__check_base_dir(base_dir)
self.__check_data_dir(data_dir, clean_data_dir)
self.__base_dir = base_dir
self.__data_dir = data_dir
if config_file == None:
config_file = self.__default_config(base_dir)
self.__check_config(config_file)
self.__config = config_file
self.__server_port = server_port
self.__server_socket = server_socket.strip()
self.__process = None
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_tb):
if self.__process is not None:
self.stop_server()
self.clean()
self.__process = None
def __observer_path(self, base_dir: str):
'''
observer程序所在路径
'''
return base_dir + "/bin/observer"
def __default_config(self, base_dir: str):
return base_dir + "/etc/observer.ini"
def __check_base_dir(self, base_dir: str):
if not(os.path.isdir(base_dir)):
raise(Exception("failed to check base directory. " + base_dir + " is not a directory"))
observer_path = self.__observer_path(base_dir)
if not(os.path.isfile(observer_path)):
raise(Exception("observer not exists: " + observer_path))
def __check_data_dir(self, data_dir: str, clean_data_dir: bool):
if os.path.exists(data_dir) and clean_data_dir:
shutil.rmtree(data_dir)
os.makedirs(data_dir, exist_ok=True)
if not(os.path.isdir(data_dir)):
raise(Exception(data_dir + " is not a directory or failed to create"))
# results = os.listdir(data_dir)
# if len(results) != 0:
# raise(Exception(data_dir + " is not empty"))
def __check_config(self, config_file: str):
if not(os.path.isfile(config_file)):
raise(Exception("config file does not exists: " + config_file))
def init_server(self):
logging.info("miniob-server inited")
# do nothing now
def start_server(self):
'''
启动服务端程序,并使用探测端口的方式检测程序是否正常启动
调试模式如果可以使用调试器启动程序就好了
'''
if self.__process != None:
logging.warn("Server has already been started")
return False
time_begin = time.time()
logging.debug("use '%s' as observer work path", os.getcwd())
observer_command = [self.__observer_path(self.__base_dir), '-f', self.__config]
if len(self.__server_socket) > 0:
observer_command.append('-s')
observer_command.append(self.__server_socket)
else:
observer_command.append('-p')
observer_command.append(str(self.__server_port))
process = subprocess.Popen(observer_command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=self.__data_dir)
return_code = process.poll()
if return_code != None:
logging.error("Failed to start observer, exit with code %d", return_code)
return False
logging.info('start subprocess with pid=%d', process.pid)
#os.setpgid(process.pid, GlobalConfig.group_id)
self.__process = process
time.sleep(0.2)
if not self.__wait_server_started(10):
time_span = time.time() - time_begin
logging.error("Failed to start server in %f seconds", time_span)
return False
time_span = time.time() - time_begin
logging.info("miniob-server started in %f seconds", time_span)
return True
def stop_server(self):
if self.__process == None:
logging.warning("Server has not been started")
return True
self.__process.terminate()
return_code = -1
try:
return_code = self.__process.wait(10)
if return_code is None:
self.__process.kill()
logging.warning("Failed to stop server: %s", self.__base_dir)
return False
except Exception as ex:
self.__process.kill()
logging.warning("wait server exit timedout: %s", self.__base_dir)
return False
logging.info("miniob-server exit with code %d. pid=%s", return_code, str(self.__process.pid))
return True
def clean(self):
'''
清理数据目录(如果没有配置调试模式)
调试模式可能需要查看服务器程序运行的日志
'''
if GlobalConfig.debug is False:
shutil.rmtree(self.__data_dir)
logging.info("miniob-server cleaned")
def __check_unix_socket_server(self):
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as s:
errno = s.connect_ex(self.__server_socket)
if errno == 0:
return True
else:
logging.debug("Failed to connect to server. err=%d:%s", errno, os.strerror(errno))
return False
def __check_tcp_socket_server(self):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
errno = s.connect_ex(('127.0.0.1', self.__server_port))
if errno == 0:
return True
else:
logging.debug("Failed to connect to server. err=%d:%s", errno, os.strerror(errno))
return False
def __wait_server_started(self, timeout_seconds: int):
deadline = time.time() + timeout_seconds
while time.time() <= deadline:
result = False
if len(self.__server_socket) > 0:
result = self.__check_unix_socket_server()
else:
result = self.__check_tcp_socket_server()
if result:
return result
time.sleep(0.5)
return False
class MiniObClient:
'''
测试客户端。使用TCP连接,向服务器发送命令并反馈结果
'''
def __init__(self, server_port: int, server_socket: str, time_limit:int = 10):
if (server_port < 0 or server_port > 65535) and server_socket is None:
raise(Exception("Invalid server port: " + str(server_port)))
self.__server_port = server_port
self.__server_socket = server_socket.strip()
self.__socket = None
self.__buffer_size = 8192
sock = None
if len(self.__server_socket) > 0:
sock = self.__init_unix_socket(self.__server_socket)
else:
sock = self.__init_tcp_socket(self.__server_port)
self.__socket = sock
if sock != None:
self.__socket.setblocking(False)
#self.__socket.settimeout(time_limit) # do not work
self.__time_limit = time_limit
self.__poller = select.poll()
self.__poller.register(self.__socket, select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR)
def __init_tcp_socket(self, server_port:int):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
errno = s.connect_ex(('127.0.0.1', server_port))
if errno != 0:
logging.error("Failed to connect to server with port %d. errno=%d:%s",
server_port, errno, os.strerror(errno))
s = None
return s
def __init_unix_socket(self, server_socket: str):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
errno = sock.connect_ex(server_socket)
if errno != 0:
logging.error("Failed to connect to server with address '%s'. errno=%d:%s",
server_socket, errno, os.strerror(errno))
sock = None
return sock
def is_valid(self):
return self.__socket is not None
def __recv_response(self):
result = ''
while True:
events = self.__poller.poll(self.__time_limit * 1000)
if len(events) == 0:
raise Exception('Poll timeout after %d second(s)' % self.__time_limit)
(_, event) = events[0]
if event & (select.POLLHUP | select.POLLERR):
msg = "Failed to receive from server. poll return POLLHUP(%s) or POLLERR(%s)" % ( str(event & select.POLLHUP), str(event & select.POLLERR))
logging.info(msg)
raise Exception(msg)
data = self.__socket.recv(self.__buffer_size)
if len(data) > 0:
result_tmp = data.decode(encoding= GlobalConfig.default_encoding)
logging.debug("receive from server[size=%d]: '%s'", len(data), result_tmp)
if data[len(data) - 1] == 0:
result += result_tmp[0:-2]
return result.strip() + '\n'
else:
result += result_tmp # TODO 返回数据量比较大的时候,python可能会hang住
# 可以考虑返回列表
else:
logging.info("receive from server error. result len=%d", len(data))
raise Exception("receive return error. the connection may be closed")
def run_sql(self, sql: str):
try:
data = str.encode(sql, GlobalConfig.default_encoding)
self.__socket.sendall(data)
self.__socket.sendall(b'\0')
logging.debug("send command to server(size=%d) '%s'", len(data) + 1, sql)
result = self.__recv_response()
logging.debug("receive result from server '%s'", result)
return True, result
except Exception as ex:
logging.error("Failed to send message to server: '%s'", str(ex))
return False, None
def close(self):
if self.__socket is not None:
self.__socket.close()
self.__socket = None
class CommandRunner:
__default_client_name = "default"
__command_prefix = "--"
__comment_prefix = "#"
def __init__(self, result_writer: ResultWriter, server_port: int, unix_socket: str):
self.__result_writer = result_writer
self.__clients = {}
# create default client
default_client = MiniObClient(server_port, unix_socket)
if not( default_client.is_valid()):
self.__is_valid = False
else:
self.__is_valid = True
self.__clients[self.__default_client_name] = default_client
self.__current_client = default_client
self.__server_port = server_port
self.__unix_socket = unix_socket
def is_valid(self):
return self.__is_valid
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, exc_tb):
self.close()
def close(self):
for client in self.__clients.values():
client.close()
self.__clients.clear()
self.__current_client = None
def run_connection(self, name: str):
'''
切换当前连接
'''
client = self.__clients[name]
if client == None:
logging.error("No such client named %s", name)
return False
self.__current_client = client
return True
def run_connect(self, name: str):
'''
创建一个连接。每个连接有一个名字,可以使用使用connection name来切换当前的连接
'''
name = name.strip()
if len(name) == 0:
logging.error("Found empty client name")
return False
client = self.__clients[name]
if client != None:
logging.error("Client with name %s already exists", name)
return False
client = MiniObClient(self.__server_port, self.__unix_socket)
if not(client.is_valid()):
logging.error("Failed to create client with name: %s", name)
return False
self.__clients[name] = client
return True
def run_echo(self, arg: str):
'''
echo 命令。参数可以是#开头的注释,这里不关心
'''
self.__result_writer.write_line(arg)
return True
def run_sql(self, sql):
self.__result_writer.write_line(sql)
result, data = self.__current_client.run_sql(sql)
if result is False:
return False
self.__result_writer.write(data)
return True
def run_sort(self, sql):
self.__result_writer.write_line(sql)
result, data = self.__current_client.run_sql(sql)
if result is False:
return False
data_l = data.strip().split('\n')
data_l.sort()
data = '\n'.join(data_l) + '\n'
self.__result_writer.write(data)
return result
def run_command(self, command_line: str):
'''
执行一条命令。命令的参数使用空格分开, 第一个字符串是命令类型
'''
command_line = command_line[len(self.__command_prefix) : ]
command_line = command_line.lstrip()
args = command_line.split(' ', 1)
command = args[0]
command_arg = ''
if len(args) > 1:
command_arg = args[1]
result = True
if 'echo' == command:
result = self.run_echo(command_arg)
elif 'connect' == command:
result = self.run_connect(command_arg)
elif 'connection' == command:
result = self.run_connection(command_arg)
elif 'sort' == command:
result = self.run_sort(command_arg)
else:
logging.error("No such command %s", command)
result = False
return result
def run_anything(self, argline: str):
argline = argline.strip()
if len(argline) == 0:
self.__result_writer.write_line('') # 读取到一个空行,也写入一个空行
return True
if argline.startswith(self.__comment_prefix):
return True
if argline.startswith(self.__command_prefix):
return self.run_command(argline)
return self.run_sql(argline)
class TestCase:
def __init__(self, is_necessary: bool, score: int):
self.__name = ''
self.__necessary = is_necessary
self.__score = score
self.__lines = []
def init_with_file(self, name, filename):
self.__name = name
with open(filename, mode='r') as f:
self.__lines = f.readlines()
return True
def init_with_content(self, name, lines):
self.__name = name
self.__lines = lines
return True
def command_lines(self):
return self.__lines
def get_name(self):
return self.__name
def is_necessary(self):
return self.__necessary
def get_score(self):
return self.__score
def result_file(self, base_dir):
subdir = ''
#if self.__necessary:
# subdir = self.NECESSARY_DIR
#else:
# subdir = self.OPTION_DIR
return base_dir + "/" + subdir + "/" + self.__name + ".result"
def tmp_result_file(self, base_dir):
result_file = self.result_file(base_dir)
return result_file + '.tmp'
class TestCaseLister:
def __init__(self, suffix = None):
if suffix != None:
self.__suffix = suffix
else:
self.__suffix = ".test"
def list_by_test_score_file(self, test_scores, test_case_file_dir: str):
'''
从test-score文件中加载所有测试用例
'''
test_cases = []
test_score_infos = test_scores.get_all()
for case_name, test_score in test_score_infos.items():
test_case = TestCase(test_score.is_necessary(), test_score.score())
test_case_file = test_case_file_dir + '/' + case_name + self.__suffix
test_case.init_with_file(case_name, test_case_file)
test_cases.append(test_case)
return test_cases
def list_directory(self, base_dir : str, is_necessary: bool):
test_case_files = []
is_dir = os.path.isdir(base_dir)
if False == is_dir:
raise(Exception("Failed to list directory while getting test cases. " + base_dir + " is not a directory"))
files = os.listdir(base_dir)
for filename in files:
logging.debug("find file %s", filename)
if filename.startswith('.'):
continue
full_path = base_dir + "/" + filename
is_file = os.path.isfile(full_path)
if False == is_file:
continue
if filename.endswith(self.__suffix):
test_case_files.append(filename)
test_cases = []
for test_case_file in test_case_files:
full_path = base_dir + "/" + test_case_file
test_case_name = test_case_file[0 : -len(self.__suffix)]
test_case = TestCase(is_necessary, 0)
test_case.init_with_file(test_case_name, full_path)
test_cases.append(test_case)
logging.debug("got a test case file %s", str(test_case_file))
return test_cases
def list_all(self, base_dir, test_names):
is_dir = os.path.isdir(base_dir)
if False == is_dir:
raise("Failed to list all test cases. " + base_dir + " is not a directory")
test_cases = []
for test_name in test_names:
full_path = base_dir + "/" + test_name + self.__suffix
if not(os.path.isfile(full_path)):
raise(Exception(full_path + " is not a file"))
test_case = TestCase(False, 0)
test_case.init_with_file(test_name, full_path)
test_cases.append(test_case)
logging.debug("got a test case %s", test_case)
return test_cases
class TestScore:
def __init__(self, is_necessary: bool, score: int):
self.__necessary = is_necessary
self.__score = score
def is_necessary(self):
return self.__necessary
def score(self):
return self.__score
class TestScores:
def __init__(self):
self.__scores = {}
self.__is_valid = False
def is_valid(self):
return self.__is_valid
def init_file(self, fp):
score_infos = json.load(fp)
self.__init(score_infos)
def init_content(self, content: str):
score_infos = json.loads(content)
self.__init(score_infos)
def __init(self, score_info_dict: dict):
scores = {}
for name, score_info in score_info_dict.items():
scores[name] = TestScore(score_info['necessary'], score_info['score'])
self.__scores = scores
self.__is_valid = True
def is_necessary(self, name):
if name in self.__scores.keys():
return self.__scores[name].is_necessary()
return None
def acquire_score(self, name):
if name in self.__scores.keys():
return self.__scores[name].score()
return None
def get_all(self):
return self.__scores
class EvalResult:
def __init__(self):
self.__message = []
self.__necessary_score = 0
self.__option_score = 0
self.__status = -1
def clear_message(self):
self.__message = []
def append_message(self, message):
self.__message.append(message)
def get_message(self):
return "\n".join(self.__message)
def add_necessary_score(self, score: int):
self.__necessary_score += score
def add_option_score(self, score: int):
self.__option_score += score
def clear_option_score(self):
self.__option_score = 0
def clear_score(self):
self.__option_score = 0
self.__necessary_score = 0
def get_score(self):
return self.__necessary_score + self.__option_score
def set_cost(self):
self.__status = 0
def set_no_cost(self):
self.__status = -1
def get_status(self):
return self.__status
def is_success(self):
return self.__status == 0
def to_json_string(self):
json_dict = {}
json_dict['score'] = self.get_score()
json_dict['message'] = self.get_message()
json_encoder = json.encoder.JSONEncoder()
json_encoder.item_separator = ','
json_encoder.key_separator = ':'
return json_encoder.encode(json_dict)
class TestSuite:
def __init__(self):
self.__report_only = False # 本次测试为了获取测试结果,不是为了校验结果
self.__test_case_base_dir = "./test"
self.__test_result_base_dir = "./result"
self.__test_result_tmp_dir = "./result/tmp" # 生成的结果存放的临时目录
self.__db_server_base_dir = None
self.__db_data_dir = None
self.__db_config = None
self.__server_port = 0
self.__use_unix_socket = False # 如果指定unix socket,那么就不再使用TCP连接
self.__need_start_server = True
self.__test_names = None # 如果指定测试哪些Case,就不再遍历所有的cases
self.__miniob_server = None
self.__test_case_scores = TestScores()
def set_test_names(self, tests):
self.__test_names = tests
def set_test_case_base_dir(self, test_case_base_dir):
self.__test_case_base_dir = test_case_base_dir
def set_test_result_base_dir(self, test_result_base_dir):
self.__test_result_base_dir = test_result_base_dir
def set_test_result_tmp_dir(self, test_result_tmp_dir: str):
self.__test_result_tmp_dir = test_result_tmp_dir
os.makedirs(test_result_tmp_dir, exist_ok=True)
if not(os.path.isdir(test_result_tmp_dir)):
raise(Exception("Failed to set test result temp directory. " + test_result_tmp_dir + " is not a directory or failed to create"))
def set_test_case_scores(self, scores_path: str):
with open(scores_path) as fp:
self.__test_case_scores.init_file(fp)
def set_db_server_base_dir(self, db_server_base_dir):
self.__db_server_base_dir = db_server_base_dir
def set_db_data_dir(self, db_data_dir):
self.__db_data_dir = db_data_dir
def set_db_config(self, db_config):
self.__db_config = db_config
def set_server_port(self, server_port):
self.__server_port = server_port
def set_use_unix_socket(self, use_unix_socket: bool):
self.__use_unix_socket = use_unix_socket
def donot_need_start_server(self):
self.__need_start_server = False
def set_report_only(self, report_only):
self.__report_only = report_only
def __compare_files(self, file1, file2):
with open(file1, 'r') as f1, open(file2, 'r') as f2:
lines1 = f1.readlines()
lines2 = f2.readlines()
if len(lines1) != len(lines2):
return False
line_num = len(lines1)
for i in range(line_num):
if lines1[i].upper() != lines2[i].upper():
logging.info('file1=%s, file2=%s, line1=%s, line2=%s', file1, file2, lines1[i], lines2[i])
return False
return True
def run_case(self, test_case, timeout=20):
# eventlet.monkey_patch()
#@timeout_decorator.timeout(timeout)
#def decorator():
try:
#with eventlet.Timeout(timeout):
ret = self.__run_case(test_case)
if ret:
return Result.true
else:
return Result.false
except TimeoutException as ex:
return Result.timeout
# try:
# ret = decorator()
# if ret:
# return Result.true
# return Result.false
# except TimeoutError:
# return Result.timeout
def __run_case(self, test_case: TestCase):
result_tmp_file_name = test_case.tmp_result_file(self.__test_result_tmp_dir)
unix_socket = ''
if self.__use_unix_socket:
unix_socket = self.__get_unix_socket_address()
with open(result_tmp_file_name, mode='wb') as result_file:
result_writer = ResultWriter(result_file)
with CommandRunner(result_writer, self.__server_port, unix_socket) as command_runner:
if command_runner.is_valid() == False:
return False
for command_line in test_case.command_lines():
result = command_runner.run_anything(command_line)
if result is False:
logging.error("Failed to run command %s in case %s", command_line, test_case.get_name())
return result
result_file_name = test_case.result_file(self.__test_result_base_dir)
if self.__report_only:
os.rename(result_tmp_file_name, result_file_name)
return True
else:
result = self.__compare_files(result_tmp_file_name, result_file_name)
if not GlobalConfig.debug:
#os.remove(result_tmp_file_name)
pass
return result
def __get_unix_socket_address(self):
return self.__db_data_dir + '/miniob.sock'
def __get_all_test_cases(self):
test_case_lister = TestCaseLister()
test_cases = []
if self.__test_case_scores.is_valid():
test_cases = test_case_lister.list_by_test_score_file(self.__test_case_scores, self.__test_case_base_dir)
else:
test_cases = test_case_lister.list_directory(self.__test_case_base_dir)
if self.__test_names is None: # 没有指定测试哪个case
return test_cases
# 指定了测试case,就从中捞出来
# 找出指定了要测试某个case,但是没有发现
test_case_result = []
for case_name in self.__test_names:
found = False
for test_case in test_cases:
if test_case.get_name() == case_name:
test_case_result.append(test_case)
logging.debug("got case: " + case_name)
found = True
if found == False:
logging.error("No such test case with name '%s'" % case_name)
return []
return test_case_result
def run(self, eval_result: EvalResult):
# 找出所有需要测试Case
test_cases = self.__get_all_test_cases()
if test_cases is None or len(test_cases) == 0:
logging.info("Cannot find any test cases")
return True
logging.info("Starting observer server")
# 测试每个Case
success_count = 0
failure_count = 0
timeout_count = 0
necessary_all_passed = True
for test_case in test_cases:
try:
# 每个case都清理并重启一下服务端,这样可以方式某个case core之后,还能测试其它case
self.__clean_server_if_need()
result = self.__start_server_if_need(True)
if result is False:
eval_result.append_message('Failed to start server.')
eval_result.set_no_cost()
return False
logging.info(test_case.get_name() + " starting ...")
result = self.run_case(test_case)
if result is Result.true:
logging.info("Case passed: %s", test_case.get_name())
success_count += 1
if test_case.is_necessary():
eval_result.add_necessary_score(test_case.get_score())
else:
eval_result.add_option_score(test_case.get_score())
eval_result.append_message("%s is success" % test_case.get_name())
else:
if self.__test_case_scores.is_necessary(test_case.get_name()):
necessary_all_passed = False
if result is Result.false:
logging.info("Case failed: %s", test_case.get_name())
failure_count += 1
eval_result.append_message("%s is error" % test_case.get_name())
else:
logging.info("Case timeout: %s", test_case.get_name())
timeout_count += 1
eval_result.append_message("%s is timeout" % test_case.get_name())
except Exception as ex:
logging.error("Failed to run case %s", test_case.get_name())
self.__clean_server_if_need()
raise ex
logging.info("All done. %d passed, %d failed, %d timeout", success_count, failure_count, timeout_count)
logging.debug(eval_result.get_message())
if necessary_all_passed is False:
eval_result.clear_option_score()
eval_result.set_cost()
self.__clean_server_if_need()
return True
def __start_server_if_need(self, clean_data_dir: bool):
if self.__miniob_server is not None:
return True
if self.__need_start_server:
unix_socket = ''
if self.__use_unix_socket:
unix_socket = self.__get_unix_socket_address()
miniob_server = MiniObServer(self.__db_server_base_dir, self.__db_data_dir,
self.__db_config, self.__server_port, unix_socket, clean_data_dir)
miniob_server.init_server()
result = miniob_server.start_server()
if result is False:
logging.error("Failed to start db server")
miniob_server.stop_server()
miniob_server.clean()
return False
self.__miniob_server = miniob_server
return True
def __clean_server_if_need(self):
if self.__miniob_server is not None:
self.__miniob_server.stop_server()
# 不再清理掉中间结果。如果从解压代码开始,那么执行的中间结果不需要再清理,所有的数据都在临时目录
# self.__miniob_server.clean()
self.__miniob_server = None
def __init_options():
options_parser = OptionParser()
# 是否仅仅生成结果,而不对结果做校验。一般在新生成一个case时使用
options_parser.add_option('', '--report-only', action='store_true', dest='report_only', default=False,
help='just report the result')
# 测试case文件存放的目录
options_parser.add_option('', '--test-case-dir', action='store', type='string', dest='test_case_base_dir', default='test',
help='the directory that contains the test files')
# 测试case文件存放的目录
options_parser.add_option('', '--test-case-scores', action='store', type='string', dest='test_case_scores', default='score.json',
help='a json file that records score of the test cases')
# 测试结果文件存放目录
options_parser.add_option('', '--test-result-dir', action='store', type='string', dest='test_result_base_dir', default='result',
help='the directory that contains the test result files')
# 生成的测试结果文件临时目录
options_parser.add_option('', '--test-result-tmp-dir', action='store', type='string', dest='test_result_tmp_dir', default='result/tmp',
help='the directory that contains the generated test result files')
# 测试哪些用例。不指定就会扫描test-case-dir目录下面的所有测试用例。指定的话,就从test-case-dir目录下面按照名字找
options_parser.add_option('', '--test-cases', action='store', type='string', dest='test_cases',
help='test cases. If none, we will iterate the test case directory. Split with \',\' if more than one')
# 测试时服务器程序基础路径,下面包含bin/observer执行主程序和etc/observer.ini配置文件
options_parser.add_option('', '--db-base-dir', action='store', type='string', dest='db_base_dir',
help='the directory of miniob database which db-base-dir/bin contains the binary executor file')
# 测试时服务器程序的数据文件存放目录
options_parser.add_option('', '--db-data-dir', action='store', type='string', dest='db_data_dir', default='miniob_data_test',
help='the directory of miniob database\'s data for test')
# 服务程序配置文件
options_parser.add_option('', '--db-config', action='store', type='string', dest='db_config',
help='the configuration of db for test. default is base_dir/etc/observer.ini')
# 服务程序端口号,客户端也使用这个端口连接服务器。目前还不具备通过配置文件解析端口配置的能力
options_parser.add_option('', '--server-port', action='store', type='int', dest='server_port', default=6789,
help='the server port. should be the same with the value in the config')
options_parser.add_option('', '--use-unix-socket', action='store_true', dest='use_unix_socket',
help='If true, server-port will be ignored and will use a random address socket.')
# 可以手动启动服务端程序,然后添加这个选项,就不会再启动服务器程序。一般调试时使用
options_parser.add_option('', '--server-started', action='store_true', dest='server_started', default=False,
help='Whether the server is already started. If true, we will not start the server')
# 测试过程中生成的日志存放的文件。使用stdout/stderr输出到控制台
options_parser.add_option('', '--log', action='store', type='string', dest='log_file', default='miniob-test.log',
help='log file. stdout=standard output and stderr=standard error')
# 是否启动调试模式。调试模式不会清理服务器的数据目录
options_parser.add_option('-d', '--debug', action='store_true', dest='debug', default=False,
help='enable debug mode')
# 测试时代码压缩文件的路径
options_parser.add_option('', '--db-code-dir', action='store', type='string', dest='db_code_dir',
help='the directory of miniob\'s code')
# 测试时代码压缩文件的解压目录
options_parser.add_option('', '--target-dir', action='store', type='string', dest='target_dir',
help='the working directory of miniob database')
# 解压的目录存在时,是否覆盖
options_parser.add_option('', '--decompress-overwrite', action='store_true', dest='decompress_overwrite', default=False,
help='whether overwrite the decompress target path if exists')
# 是否需要解压和编译代码
options_parser.add_option('', '--code-type', action='store', dest='code_type', default='compress',
help='compress/git/none. Compress: decompress the code and compile. git: git clone and compile. none: do nothing')
options_parser.add_option('', '--compile-make-args', action='store', type='string', dest='compile_make_args', default='',
help='compile args used by make')
options_parser.add_option('', '--compile-cmake-args', action='store', type='string', dest='compile_cmake_args', default='',
help='compile args used by cmake')
# 之前已经编译过,是否需要重新编译,还是直接执行make就可以了
options_parser.add_option('', '--compile-rebuild', action='store_true', default=False, dest='compile_rebuild',
help='whether rebuild if build path exists')
options_parser.add_option('', '--git-repo', action='store', dest='git_repo',
help='the git repo in https')
options_parser.add_option('', '--git-branch', action='store', dest='git_branch', default='',
help='the git repo branch')
options_parser.add_option('', '--git-repo-prefix', action='store', dest='git_repo_prefix', default='https://github.com',
help='the git repo prefix in https')
options_parser.add_option('', '--git-user', action='store', dest='git_user', default='',
help='git user name to download source code')
options_parser.add_option('', '--git-token', action='store', dest='git_token', default='',
help='git token to download source code')
options, args = options_parser.parse_args(sys.argv[1:])
return options
def __init_log(options):
log_level = logging.INFO
if options.debug:
log_level = logging.DEBUG
GlobalConfig.debug = True
GlobalConfig.debug = True
log_stream = None
if 'stdout' == options.log_file:
log_stream = sys.stdout
elif 'stderr' == options.log_file:
log_stream = sys.stderr
else:
log_file_dir = os.path.dirname(options.log_file)
os.makedirs(log_file_dir, exist_ok=True)
log_format = "%(asctime)s - %(levelname)-5s %(name)s %(lineno)s - %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
if log_stream is None:
logging.basicConfig(level=log_level, filename=options.log_file, format=log_format, datefmt=log_date_format)
else:
logging.basicConfig(level=log_level, stream=log_stream, format=log_format, datefmt=log_date_format)
def __init_test_suite(options):
test_suite = TestSuite()
test_suite.set_test_case_base_dir(os.path.abspath(options.test_case_base_dir))
test_suite.set_test_case_scores(os.path.abspath(options.test_case_scores))
test_suite.set_test_result_base_dir(os.path.abspath(options.test_result_base_dir))
test_suite.set_test_result_tmp_dir(os.path.abspath(options.test_result_tmp_dir))
if options.db_base_dir is not None:
test_suite.set_db_server_base_dir(os.path.abspath(options.db_base_dir))
if options.db_data_dir is not None:
test_suite.set_db_data_dir(os.path.abspath(options.db_data_dir))
test_suite.set_server_port(options.server_port)
test_suite.set_use_unix_socket(options.use_unix_socket)
if options.server_started:
test_suite.donot_need_start_server()
if options.db_config is not None:
test_suite.set_db_config(os.path.abspath(options.db_config))
if options.test_cases is not None:
test_suite.set_test_names(options.test_cases.split(','))
if options.report_only:
test_suite.set_report_only(True)
return test_suite
def __init_test_suite_with_source_code(options, eval_result):
os.makedirs(options.target_dir, exist_ok=True)
target_path = os.path.abspath(options.target_dir)
proj_path = __get_project_path(target_path)
build_path = __get_build_path(target_path)
if options.code_type == 'compress':
code_path = os.path.abspath(options.db_code_dir)
if not unzip(code_path, target_path, options.decompress_overwrite):
message = "decompress the code failed"
logging.error(message)
raise Exception(message)
else:
logging.info("decompress source code done")
elif options.code_type == 'git':
result = git_clone(options.git_repo, options.git_branch, options.git_repo_prefix,
options.git_user, options.git_token, proj_path, 10, eval_result)
if not result:
return None
if not compile(proj_path, build_path, options.compile_cmake_args, options.compile_make_args, options.compile_rebuild, eval_result):
message = "Failed to compile source code"
logging.error(message)
return None
logging.info("compile source code done")
# 覆盖一些测试的路径
logging.info("some config will be override if exists")
test_suite = __init_test_suite(options)
test_suite.set_db_data_dir(__get_data_path(target_path))
test_suite.set_db_server_base_dir(__get_build_path(target_path))
test_suite.set_db_config(proj_path + '/etc/observer.ini')
return test_suite
def __run_shell_command(command_args):
'''
运行shell命令,返回命令的执行结果码和输出到控制台的信息
返回的控制台信息是每行一个字符串的字符串列表
'''
logging.info("running command: '%s'", ' '.join(command_args))
outputs = []
command_process = subprocess.Popen(command_args, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
while True:
line = command_process.stderr.readline()
line_str = line.decode(GlobalConfig.default_encoding)
if isinstance(line_str, str):
outputs.append(line_str.strip())
return_code = command_process.poll()
if return_code is not None:
return return_code, outputs
def git_pull(to_path: str, timeout:int, eval_result:EvalResult):
logging.info('running git pull in %s and will wait %d seconds', to_path, timeout)
command_args = ['git', 'pull']
process = subprocess.Popen(command_args, cwd=to_path)
try:
return_code = process.wait(timeout=timeout)
if return_code != 0:
logging.error("Failed to pull source code from repo. return code=%d", return_code)
return False
logging.info("pull source code success")
return True
except Exception as ex:
process.kill()
logging.error("Failed to pull source code from repo. exception=%s", str(ex))
return False
return True
def git_clone(repo: str, branch: str, repo_prefix: str,
user_name: str, password: str,
to_path: str, timeout:int, eval_result: EvalResult):
'''
从指定仓库拉取代码。
to_path: 拉取的代码放的目录。比如 test-tmp/ob_rookie/miniob
'''
if os.path.exists(to_path):
# 目标目录已经存在,可以尝试直接执行git pull
result = git_pull(to_path, timeout, eval_result)
if result: # 如果拉取失败,就尝试重新clone
return True
# 清理原有目录,再重新拉取
logging.info("Failed to pull source code. clean the directory and clone it. path=%s", to_path)
shutil.rmtree(to_path)
if not repo.startswith(repo_prefix):
error = 'git repo must be starts with ' + repo_prefix + ', but got ' + repo
logging.error(error)
eval_result.append_message(error)
return False
if user_name or password:
target_repo = repo.replace(repo_prefix, 'https://' + user_name + ':' + password + '@github.com/')
target_repo_in_log = target_repo.replace(password, '****')
else:
target_repo = repo
target_repo_in_log = target_repo
logging.info('git clone from %s', target_repo_in_log)
command_args = ['git', 'clone', target_repo, to_path]
if len(branch) != 0:
command_args.append('-b')
command_args.append(branch)
process = subprocess.Popen(command_args)
try:
return_code = process.wait(timeout=timeout)
if return_code != 0:
error = 'Failed to clone repo from ' + target_repo_in_log + ', return code =' + str(return_code)
logging.error(error)
eval_result.append_message(error)
return False
except Exception as ex:
process.kill()
error = 'failed to clone repo from ' + target_repo_in_log + '. exception=' + str(ex)
logging.error(error)
eval_result.append_message(error)
return False
return True
def unzip(source_dir: str, target_dir: str, overwrite: bool):
if not os.path.exists(source_dir):
logging.error('The source_dir %s doesn\'t exist, please provide a vaild source path.', source_dir)
return False
if os.path.isdir(target_dir) and len(os.listdir(target_dir)) != 0:
if overwrite:
shutil.rmtree(target_dir)
logging.info("target directory will be cleaned: %s", target_dir)
else:
logging.error('target directory is not empty: %s', target_dir)
return False
if not os.path.exists(target_dir):
logging.info("decompress target directory does not exists, try to create it")
os.makedirs(target_dir)
ret, outputs = __run_shell_command(["unzip", "-q", "-d", target_dir, source_dir])
if ret != 0:
logging.error("Failed to decompress the zip package. source_dir=%s, target_dir=%s",
source_dir, target_dir)
for output in outputs:
logging.error(output)
return False
logging.info("decompress the zip package success. source_dir=%s, target_dir=%s",
source_dir, target_dir)
return True
def run_cmake(work_dir: str, build_path: str, cmake_args: str):
cmake_command = ["cmake", "-B", build_path, "--log-level=WARNING"]
if isinstance(cmake_args, str):
args = cmake_args.split(';')
for arg in args:
arg = arg.strip()
if len(arg) > 0:
cmake_command.append(arg)
cmake_command.append(work_dir)
ret, outputs = __run_shell_command(cmake_command)
if ret != 0:
logging.error("Failed to run cmake command")
for output in outputs:
logging.error(output)
return False, outputs
return True, []
def compile(work_dir: str, build_dir: str, cmake_args: str, make_args: str, rebuild_all: bool, eval_result: EvalResult):
'''
workd_dir是源代码所在目录(miniob目录)
build_dir 是编译结果的目录
'''
if not os.path.exists(work_dir):
logging.error('The work_dir %s doesn\'t exist, please provide a vaild work path.', work_dir)
return False
#now_path = os.getcwd()
build_path = build_dir
if os.path.exists(build_path) and rebuild_all:
logging.info('build directory is not empty but will be cleaned before compile: %s', build_path)
shutil.rmtree(build_path)
os.makedirs(build_path, exist_ok=True)
logging.info("start compiling ... build path=%s", build_path)
ret, outputs = run_cmake(work_dir, build_path, cmake_args)
if ret == False:
# cmake 执行失败时,清空整个Build目录,再重新执行一次cmake命令
shutil.rmtree(build_path)
os.makedirs(build_path, exist_ok=True)
ret, outputs = run_cmake(work_dir, build_path, cmake_args)
if ret == False:
for output in outputs:
logging.error(output)
eval_result.append_message(output)
return False
make_command = ["make", "--silent", "-C", build_path]
if isinstance(make_args, str):
args = make_args.split(';')
for arg in args:
arg = arg.strip()
if len(arg) > 0:
make_command.append(arg)
ret, outputs = __run_shell_command(make_command)
if ret != 0:
logging.error("Compile failed")
for output in outputs:
logging.error(output.strip())
eval_result.append_message(output.strip())
return False
return True
def run(options):
'''
return result, reason
result: True or False
'''
__init_log(options)
logging.info("miniob test starting ...")
# 由于miniob-test测试程序导致的失败,才认为是失败
# 比如解压代码失败,git clone超时,目录没有权限等,对miniob-test来说都是成功的
# git clone由于权限原因失败、编译失败等,对miniob-test来说是成功的
result = True
eval_result = EvalResult()
try:
test_suite = None
if options.code_type == 'compress' or options.code_type == 'git':
test_suite = __init_test_suite_with_source_code(options, eval_result)
else:
test_suite = __init_test_suite(options)
if test_suite != None:
result = test_suite.run(eval_result)
# result = True
except Exception as ex:
logging.exception(ex)
result = False
#eval_result.clear_message()
eval_result.append_message(str(ex.args))
eval_result.set_no_cost()
eval_result.clear_score()
return result, eval_result.to_json_string()
if __name__ == '__main__':
os.setpgrp()
options = __init_options()
result, evaluation = run(options)
exit_code = 0
if result is False:
exit_code = 1
else:
logging.info(evaluation)
exit(exit_code)
BASIC INSERT
create table t_basic(id int, age int, name char, score float);
SUCCESS
insert into t_basic values(1,1, 'a', 1.0);
SUCCESS
insert into t_basic values(2,2, 'b', 2.0);
SUCCESS
insert into t_basic values(4,4, 'c', 3.0);
SUCCESS
insert into t_basic values(3,3, 'd', 4.0);
SUCCESS
insert into t_basic values(5,5, 'e', 5.5);
SUCCESS
insert into t_basic values(6,6, 'f', 6.6);
SUCCESS
insert into t_basic values(7,7, 'g', 7.7);
SUCCESS
select * from t_basic;
1 | 1 | A | 1
2 | 2 | B | 2
3 | 3 | D | 4
4 | 4 | C | 3
5 | 5 | E | 5.5
6 | 6 | F | 6.6
7 | 7 | G | 7.7
ID | AGE | NAME | SCORE
BASIC DELETE
delete from t_basic where id=3;
SUCCESS
select * from t_basic;
1 | 1 | A | 1
2 | 2 | B | 2
4 | 4 | C | 3
5 | 5 | E | 5.5
6 | 6 | F | 6.6
7 | 7 | G | 7.7
ID | AGE | NAME | SCORE
BASIC SELECT
select * from t_basic where id=1;
ID | AGE | NAME | SCORE
1 | 1 | A | 1
select * from t_basic where id>=5;
5 | 5 | E | 5.5
6 | 6 | F | 6.6
7 | 7 | G | 7.7
ID | AGE | NAME | SCORE
select * from t_basic where age>1 and age<3;
ID | AGE | NAME | SCORE
2 | 2 | B | 2
select * from t_basic where t_basic.id=1 and t_basic.age=1;
ID | AGE | NAME | SCORE
1 | 1 | A | 1
select * from t_basic where id=1 and age=1;
ID | AGE | NAME | SCORE
1 | 1 | A | 1
select id, age, name, score from t_basic;
1 | 1 | A | 1
2 | 2 | B | 2
4 | 4 | C | 3
5 | 5 | E | 5.5
6 | 6 | F | 6.6
7 | 7 | G | 7.7
ID | AGE | NAME | SCORE
select t_basic.id, t_basic.age, t_basic.name, t_basic.score from t_basic;
1 | 1 | A | 1
2 | 2 | B | 2
4 | 4 | C | 3
5 | 5 | E | 5.5
6 | 6 | F | 6.6
7 | 7 | G | 7.7
ID | AGE | NAME | SCORE
select t_basic.id, t_basic.age, name from t_basic;
1 | 1 | A
2 | 2 | B
4 | 4 | C
5 | 5 | E
6 | 6 | F
7 | 7 | G
ID | AGE | NAME
CREATE INDEX
create index i_id on t_basic (id);
SUCCESS
select * from t_basic;
1 | 1 | A | 1
2 | 2 | B | 2
4 | 4 | C | 3
5 | 5 | E | 5.5
6 | 6 | F | 6.6
7 | 7 | G | 7.7
ID | AGE | NAME | SCORE
INITIALIZATION
CREATE TABLE aggregation_func(id int, num int, price float, addr char, birthday date);
SUCCESS
INSERT INTO aggregation_func VALUES (1, 18, 10.0, 'abc', '2020-01-01');
SUCCESS
INSERT INTO aggregation_func VALUES (2, 15, 20.0, 'abc', '2010-01-11');
SUCCESS
INSERT INTO aggregation_func VALUES (3, 12, 30.0, 'def', '2021-01-21');
SUCCESS
INSERT INTO aggregation_func VALUES (4, 15, 30.0, 'dei', '2021-01-31');
SUCCESS
1. COUNT
SELECT count(*) FROM aggregation_func;
COUNT(*)
4
SELECT count(num) FROM aggregation_func;
COUNT(NUM)
4
2. MIN
SELECT min(num) FROM aggregation_func;
MIN(NUM)
12
SELECT min(price) FROM aggregation_func;
MIN(PRICE)
10
SELECT min(addr) FROM aggregation_func;
MIN(ADDR)
ABC
3. MAX
SELECT max(num) FROM aggregation_func;
MAX(NUM)
18
SELECT max(price) FROM aggregation_func;
MAX(PRICE)
30
SELECT max(addr) FROM aggregation_func;
MAX(ADDR)
DEI
4. AVG
SELECT avg(num) FROM aggregation_func;
AVG(NUM)
15
SELECT avg(price) FROM aggregation_func;
AVG(PRICE)
22.5
5. ERROR WITH *
SELECT min(*) FROM aggregation_func;
FAILURE
SELECT max(*) FROM aggregation_func;
FAILURE
SELECT avg(*) FROM aggregation_func;
FAILURE
6. ERROR WITH REDUNDANT COLUMNS
SELECT count(*,num) FROM aggregation_func;
FAILURE
SELECT min(num,price) FROM aggregation_func;
FAILURE
SELECT max(num,price) FROM aggregation_func;
FAILURE
SELECT avg(num,price) FROM aggregation_func;
FAILURE
7. ERROR WITH EMPTY COLUMNS
SELECT count() FROM aggregation_func;
FAILURE
SELECT min() FROM aggregation_func;
FAILURE
SELECT max() FROM aggregation_func;
FAILURE
SELECT avg() FROM aggregation_func;
FAILURE
8. ERROR WITH NON-EXISTENT COLUMNS
SELECT count(id2) FROM aggregation_func;
FAILURE
SELECT min(id2) FROM aggregation_func;
FAILURE
SELECT max(id2) FROM aggregation_func;
FAILURE
SELECT avg(id2) FROM aggregation_func;
FAILURE
9. SELECT MANY AGGREGATION
SELECT min(num),max(num),avg(num) FROM aggregation_func;
MIN(NUM) | MAX(NUM) | AVG(NUM)
12 | 18 | 15
INITIALIZATION
CREATE TABLE csq_1(id int, col1 int, feat1 float);
SUCCESS
CREATE TABLE csq_2(id int, col2 int, feat2 float);
SUCCESS
CREATE TABLE csq_3(id int, col3 int, feat3 float);
SUCCESS
CREATE TABLE csq_4(id int, col4 int, feat4 float);
SUCCESS
INSERT INTO csq_1 VALUES (1, 4, 11.2);
SUCCESS
INSERT INTO csq_1 VALUES (2, 2, 12.0);
SUCCESS
INSERT INTO csq_1 VALUES (3, 3, 13.5);
SUCCESS
INSERT INTO csq_2 VALUES (1, 2, 13.0);
SUCCESS
INSERT INTO csq_2 VALUES (2, 7, 10.5);
SUCCESS
INSERT INTO csq_2 VALUES (5, 3, 12.6);
SUCCESS
INSERT INTO csq_3 VALUES (1, 2, 11.0);
SUCCESS
INSERT INTO csq_3 VALUES (3, 6, 16.5);
SUCCESS
INSERT INTO csq_3 VALUES (5, 5, 14.6);
SUCCESS
1. SELECT
select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id in (select csq_3.id from csq_3));
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id not in (select csq_3.id from csq_3));
2 | 2 | 12
ID | COL1 | FEAT1
select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id not in (select csq_3.id from csq_3));
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id in (select csq_3.id from csq_3));
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from csq_1 where col1 > (select avg(csq_2.col2) from csq_2 where csq_2.feat2 >= (select min(csq_3.feat3) from csq_3));
1 | 4 | 11.2
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from csq_1 where (select avg(csq_2.col2) from csq_2 where csq_2.feat2 > (select min(csq_3.feat3) from csq_3)) = col1;
ID | COL1 | FEAT1
select * from csq_1 where (select avg(csq_2.col2) from csq_2) <> (select avg(csq_3.col3) from csq_3);
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from csq_1 where feat1 > (select min(csq_2.feat2) from csq_2) and col1 <= (select min(csq_3.col3) from csq_3);
2 | 2 | 12
ID | COL1 | FEAT1
select * from csq_1 where (select max(csq_2.feat2) from csq_2) > feat1 and col1 > (select min(csq_3.col3) from csq_3);
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from csq_1 where (select max(csq_2.feat2) from csq_2) > feat1 and (select min(csq_3.col3) from csq_3) < col1;
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from csq_1 where feat1 <> (select avg(csq_2.feat2) from csq_2 where csq_2.feat2 > csq_1.feat1);
1 | 4 | 11.2
2 | 2 | 12
ID | COL1 | FEAT1
select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id in (select csq_3.id from csq_3 where csq_1.id = csq_3.id));
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
2. SELECT WITH EMPTY TABLE
select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id in (select csq_3.id from csq_3 where 1=0));
ID | COL1 | FEAT1
select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id in (select csq_3.id from csq_3 where 1=0) and 1=0);
ID | COL1 | FEAT1
select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id not in (select csq_3.id from csq_3 where 1=0));
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id not in (select csq_3.id from csq_3) and 1=0);
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from csq_3 where feat3 < (select max(csq_2.feat2) from csq_2 where csq_2.id not in (select csq_3.id from csq_3 where 1=0));
1 | 2 | 11
ID | COL3 | FEAT3
select * from csq_3 where feat3 < (select max(csq_2.feat2) from csq_2 where csq_2.id not in (select csq_3.id from csq_3 ) and 1=0);
ID | COL3 | FEAT3
3. ERROR
select * from csq_1 where col1 = (select csq_2.col2 from csq_2);
FAILURE
select * from csq_1 where col1 = (select * from csq_2);
FAILURE
select * from csq_1 where col1 in (select * from csq_2);
FAILURE
select * from csq_1 where col1 not in (select * from csq_2);
FAILURE
INITIALIZATION
CREATE TABLE date_table(id int, u_date date);
SUCCESS
CREATE INDEX index_id on date_table(u_date);
SUCCESS
1. INSERT NORMAL DATE DATA
INSERT INTO date_table VALUES (1,'2020-01-21');
SUCCESS
INSERT INTO date_table VALUES (2,'2020-10-21');
SUCCESS
INSERT INTO date_table VALUES (3,'2020-1-01');
SUCCESS
INSERT INTO date_table VALUES (4,'2020-01-1');
SUCCESS
INSERT INTO date_table VALUES (5,'2019-12-21');
SUCCESS
INSERT INTO date_table VALUES (6,'2016-2-29');
SUCCESS
INSERT INTO date_table VALUES (7,'1970-1-1');
SUCCESS
INSERT INTO date_table VALUES (8,'2000-01-01');
SUCCESS
INSERT INTO date_table VALUES (9,'2038-1-19');
SUCCESS
2. COMPARE DATE DATA
SELECT * FROM date_table WHERE u_date>'2020-1-20';
1 | 2020-01-21
2 | 2020-10-21
9 | 2038-01-19
ID | U_DATE
SELECT * FROM date_table WHERE u_date<'2019-12-31';
5 | 2019-12-21
6 | 2016-02-29
7 | 1970-01-01
8 | 2000-01-01
ID | U_DATE
SELECT * FROM date_table WHERE u_date='2020-1-1';
3 | 2020-01-01
4 | 2020-01-01
ID | U_DATE
3. DELETE DATA
DELETE FROM date_table WHERE u_date>'2012-2-29';
SUCCESS
SELECT * FROM date_table;
7 | 1970-01-01
8 | 2000-01-01
ID | U_DATE
4. CHECK INVALID DATE DATA
SELECT * FROM date_table WHERE u_date='2017-2-29';
FAILURE
SELECT * FROM date_table WHERE u_date='2017-21-29';
FAILURE
SELECT * FROM date_table WHERE u_date='2017-12-32';
FAILURE
SELECT * FROM date_table WHERE u_date='2017-11-31';
FAILURE
INSERT INTO date_table VALUES (10,'2017-2-29');
FAILURE
INSERT INTO date_table VALUES (11,'2017-21-29');
FAILURE
INSERT INTO date_table VALUES (12,'2017-12-32');
FAILURE
INSERT INTO date_table VALUES (13,'2017-11-31');
FAILURE
1. DROP EMPTY TABLE
CREATE TABLE Drop_table_1(id int, t_name char);
SUCCESS
DROP TABLE Drop_table_1;
SUCCESS
2. DROP NON-EMPTY TABLE
CREATE TABLE Drop_table_2(id int, t_name char);
SUCCESS
INSERT INTO Drop_table_2 VALUES (1,'OB');
SUCCESS
DROP TABLE Drop_table_2;
SUCCESS
3. CHECK THE ACCURACY OF DROPPING TABLE
CREATE TABLE Drop_table_3(id int, t_name char);
SUCCESS
INSERT INTO Drop_table_3 VALUES (1,'OB');
SUCCESS
SELECT * FROM Drop_table_3;
1 | OB
ID | T_NAME
DROP TABLE Drop_table_3;
SUCCESS
INSERT INTO Drop_table_3 VALUES (1,'OB');
FAILURE
SELECT * FROM Drop_table_3;
FAILURE
DELETE FROM Drop_table_3 WHERE id = 3;
FAILURE
CREATE TABLE Drop_table_3(id int, t_name char);
SUCCESS
SELECT * FROM Drop_table_3;
ID | T_NAME
4. DROP NON-EXISTENT TABLE
CREATE TABLE Drop_table_4(id int, t_name char);
SUCCESS
DROP TABLE Drop_table_4;
SUCCESS
DROP TABLE Drop_table_4;
FAILURE
DROP TABLE Drop_table_4_1;
FAILURE
5. CREATE A TABLE WHICH HAS DROPPED
CREATE TABLE Drop_table_5(id int, t_name char);
SUCCESS
DROP TABLE Drop_table_5;
SUCCESS
CREATE TABLE Drop_table_5(id int, t_name char);
SUCCESS
SELECT * FROM Drop_table_5;
ID | T_NAME
6. DROP A TABLE WITH INDEX
CREATE TABLE Drop_table_6(id int, t_name char);
SUCCESS
CREATE INDEX index_id on Drop_table_6(id);
SUCCESS
INSERT INTO Drop_table_6 VALUES (1,'OB');
SUCCESS
SELECT * FROM Drop_table_6;
1 | OB
ID | T_NAME
DROP TABLE Drop_table_6;
SUCCESS
SELECT * FROM Drop_table_6;
FAILURE
INITIALIZATION
create table exp_table(id int, col1 int, col2 int, col3 float, col4 float);
SUCCESS
insert into exp_table VALUES (1, 1, 1, 1.0, 1.5);
SUCCESS
insert into exp_table VALUES (2, 2, -2, 5.5, 1.0);
SUCCESS
insert into exp_table VALUES (3, 3, 4, 5.0, 4.0);
SUCCESS
1. SELECT
select * from exp_table where 1 = 5/4;
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where col1-2 > 0;
3 | 3 | 4 | 5 | 4
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 2+col2 < 1;
2 | 2 | -2 | 5.5 | 1
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where col1*col2 < 0;
2 | 2 | -2 | 5.5 | 1
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 5/4 = 1;
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 0 < col1-2;
3 | 3 | 4 | 5 | 4
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 1.0 > 2+col2;
2 | 2 | -2 | 5.5 | 1
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where -0 < col1-col2;
2 | 2 | -2 | 5.5 | 1
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 0 < -2+col1;
3 | 3 | 4 | 5 | 4
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 1+1 = 2*1.0;
1 | 1 | 1 | 1 | 1.5
2 | 2 | -2 | 5.5 | 1
3 | 3 | 4 | 5 | 4
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 5/4*8 < 4+col2*col3/2;
3 | 3 | 4 | 5 | 4
ID | COL1 | COL2 | COL3 | COL4
select * from exp_table where 5/4*8 < (4+col2)*col3/2;
3 | 3 | 4 | 5 | 4
ID | COL1 | COL2 | COL3 | COL4
select id,-(col2*(-1)+1)+(col4+2)*(col1+col3*2),(4+col2)*col3/2 from exp_table where -(col2*(-1)+1)+(col4+2)*(col1+col3*2) > (4+col2)*col3/2;
1 | 10.5 | 2.5
2 | 36 | 5.5
3 | 81 | 20
ID | -(COL2*(-1)+1)+(COL4+2)*(COL1+COL3*2) | (4+COL2)*COL3/2
select id,col1,col2,col3,col4,6-(col2*(1+col1))+(col4+2)/(1+col1*4+col3*2) from exp_table where 6-(col2*(1+col1))+(col4+2)/(1+col1*4+col3*2) > 5;
2 | 2 | -2 | 5.5 | 1 | 12.15
ID | COL1 | COL2 | COL3 | COL4 | 6-(COL2*(1+COL1))+(COL4+2)/(1+COL1*4+COL3*2)
select id,col1,col2,col3,col4,3*col1/(col2+2) from exp_table where 3*col1/(col2+2) > 1;
3 | 3 | 4 | 5 | 4 | 1.5
ID | COL1 | COL2 | COL3 | COL4 | 3*COL1/(COL2+2)
select id,3*col1/(col2+2) from exp_table where 3*col1/(col2+2)+1/0 > 1;
ID | 3*COL1/(COL2+2)
select * from exp_table where 1/0 = 1/0;
ID | COL1 | COL2 | COL3 | COL4
2. EXPRESSION ABOUT MANY TABLES
create table exp_table2(id int, col1 int);
SUCCESS
insert into exp_table2 VALUES (1, 1);
SUCCESS
insert into exp_table2 VALUES (2, 3);
SUCCESS
select exp_table.id,3*exp_table2.col1/(exp_table.col2+2) from exp_table,exp_table2 where 3*exp_table2.col1/(exp_table.col2+2)>1;
1 | 3
3 | 1.5
exp_table.ID | 3*EXP_TABLE2.COL1/(EXP_TABLE.COL2+2)
1. CREATE TABLE
create table t_group_by (id int, score float, name char);
SUCCESS
create table t_group_by_2 (id int, age int);
SUCCESS
2. INSERT RECORDS
insert into t_group_by values(3, 1.0, 'a');
SUCCESS
insert into t_group_by values(1, 2.0, 'b');
SUCCESS
insert into t_group_by values(4, 3.0, 'c');
SUCCESS
insert into t_group_by values(3, 2.0, 'c');
SUCCESS
insert into t_group_by values(3, 4.0, 'c');
SUCCESS
insert into t_group_by values(3, 3.0, 'd');
SUCCESS
insert into t_group_by values(3, 2.0, 'f');
SUCCESS
insert into t_group_by_2 values(1, 10);
SUCCESS
insert into t_group_by_2 values(2, 20);
SUCCESS
insert into t_group_by_2 values(3, 10);
SUCCESS
insert into t_group_by_2 values(3, 20);
SUCCESS
insert into t_group_by_2 values(3, 40);
SUCCESS
insert into t_group_by_2 values(4, 20);
SUCCESS
3. PRIMARY GROUP BY
select id, avg(score) from t_group_by group by id;
1 | 2
3 | 2.4
4 | 3
ID | AVG(SCORE)
select name, min(id), max(score) from t_group_by group by name;
A | 3 | 1
B | 1 | 2
C | 3 | 4
D | 3 | 3
F | 3 | 2
NAME | MIN(ID) | MAX(SCORE)
select id, name, avg(score) from t_group_by group by id, name;
1 | B | 2
3 | A | 1
3 | C | 3
3 | D | 3
3 | F | 2
4 | C | 3
ID | NAME | AVG(SCORE)
4. WITH WHERE CONDITION
select id, avg(score) from t_group_by where id>2 group by id;
3 | 2.4
4 | 3
ID | AVG(SCORE)
select name, count(id), max(score) from t_group_by where name > 'a' and id>=0 group by name;
B | 1 | 2
C | 3 | 4
D | 1 | 3
F | 1 | 2
NAME | COUNT(ID) | MAX(SCORE)
5. MULTI TABLE
select t_group_by.id, t_group_by.name, avg(t_group_by.score), avg(t_group_by_2.age) from t_group_by, t_group_by_2 where t_group_by.id=t_group_by_2.id group by t_group_by.id, t_group_by.name;
1 | B | 2 | 10
3 | A | 1 | 23.33
3 | C | 3 | 23.33
3 | D | 3 | 23.33
3 | F | 2 | 23.33
4 | C | 3 | 20
T_GROUP_BY.ID | T_GROUP_BY.NAME | AVG(T_GROUP_BY.SCORE) | AVG(T_GROUP_BY_2.AGE)
INITIALIZATION
CREATE TABLE insert_table(id int, t_name char, col1 int, col2 int);
SUCCESS
1. INSERT
INSERT INTO insert_table VALUES (1,'N1',1,1);
SUCCESS
INSERT INTO insert_table VALUES (2,'N2',1,1),(3,'N3',2,1);
SUCCESS
2. ERROR
INSERT INTO insert_table VALUES (4,'N4',1,1),(1,1,1);
FAILURE
INSERT INTO insert_table VALUES (4,'N4',1,1),(1,1,1,1);
FAILURE
3. SELECT
SELECT * FROM insert_table;
1 | N1 | 1 | 1
2 | N2 | 1 | 1
3 | N3 | 2 | 1
ID | T_NAME | COL1 | COL2
INITIALIZATION
CREATE TABLE join_table_1(id int, name char);
SUCCESS
CREATE TABLE join_table_2(id int, num int);
SUCCESS
CREATE TABLE join_table_3(id int, num2 int);
SUCCESS
create table join_table_empty_1(id int, num_empty_1 int);
SUCCESS
create table join_table_empty_2(id int, num_empty_2 int);
SUCCESS
INSERT INTO join_table_1 VALUES (1, 'a');
SUCCESS
INSERT INTO join_table_1 VALUES (2, 'b');
SUCCESS
INSERT INTO join_table_1 VALUES (3, 'c');
SUCCESS
INSERT INTO join_table_2 VALUES (1, 2);
SUCCESS
INSERT INTO join_table_2 VALUES (2, 15);
SUCCESS
INSERT INTO join_table_3 VALUES (1, 120);
SUCCESS
INSERT INTO join_table_3 VALUES (3, 800);
SUCCESS
1. SELECT
Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id;
1 | A | 1 | 2
2 | B | 2 | 15
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM
Select join_table_1.name from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id;
A
B
JOIN_TABLE_1.NAME
Select join_table_2.num from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id;
15
2
JOIN_TABLE_2.NUM
Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id inner join join_table_3 on join_table_1.id=join_table_3.id;
1 | A | 1 | 2 | 1 | 120
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM | JOIN_TABLE_3.ID | JOIN_TABLE_3.NUM2
Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id and join_table_2.num>13 where join_table_1.name='b';
2 | B | 2 | 15
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM
Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id and join_table_2.num>13 where join_table_1.name='a';
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM
Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id and join_table_2.num>23 where join_table_1.name='b';
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM
3. EMPTY
select * from join_table_1 inner join join_table_empty_1 on join_table_1.id=join_table_empty_1.id;
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_EMPTY_1.ID | JOIN_TABLE_EMPTY_1.NUM_EMPTY_1
select * from join_table_empty_1 inner join join_table_1 on join_table_empty_1.id=join_table_1.id;
JOIN_TABLE_EMPTY_1.ID | JOIN_TABLE_EMPTY_1.NUM_EMPTY_1 | JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME
select * from join_table_empty_1 inner join join_table_empty_2 on join_table_empty_1.id = join_table_empty_2.id;
JOIN_TABLE_EMPTY_1.ID | JOIN_TABLE_EMPTY_1.NUM_EMPTY_1 | JOIN_TABLE_EMPTY_2.ID | JOIN_TABLE_EMPTY_2.NUM_EMPTY_2
select * from join_table_1 inner join join_table_2 on join_table_1.id = join_table_2.id inner join join_table_empty_1 on join_table_1.id=join_table_empty_1.id;
JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM | JOIN_TABLE_EMPTY_1.ID | JOIN_TABLE_EMPTY_1.NUM_EMPTY_1
select * from join_table_empty_1 inner join join_table_1 on join_table_empty_1.id=join_table_1.id inner join join_table_2 on join_table_1.id=join_table_2.id;
JOIN_TABLE_EMPTY_1.ID | JOIN_TABLE_EMPTY_1.NUM_EMPTY_1 | JOIN_TABLE_1.ID | JOIN_TABLE_1.NAME | JOIN_TABLE_2.ID | JOIN_TABLE_2.NUM
4. VERY LARGE JOIN
create table join_table_large_1(id int, num1 int);
SUCCESS
create table join_table_large_2(id int, num2 int);
SUCCESS
create table join_table_large_3(id int, num3 int);
SUCCESS
create table join_table_large_4(id int, num4 int);
SUCCESS
create table join_table_large_5(id int, num5 int);
SUCCESS
create table join_table_large_6(id int, num6 int);
SUCCESS
insert into join_table_large_1 values(1, 1);
SUCCESS
insert into join_table_large_1 values(2, 2);
SUCCESS
insert into join_table_large_1 values(3, 3);
SUCCESS
insert into join_table_large_1 values(4, 4);
SUCCESS
insert into join_table_large_1 values(5, 5);
SUCCESS
insert into join_table_large_1 values(6, 6);
SUCCESS
insert into join_table_large_1 values(7, 7);
SUCCESS
insert into join_table_large_1 values(8, 8);
SUCCESS
insert into join_table_large_1 values(9, 9);
SUCCESS
insert into join_table_large_1 values(10, 10);
SUCCESS
insert into join_table_large_1 values(11, 11);
SUCCESS
insert into join_table_large_1 values(12, 12);
SUCCESS
insert into join_table_large_1 values(13, 13);
SUCCESS
insert into join_table_large_1 values(14, 14);
SUCCESS
insert into join_table_large_1 values(15, 15);
SUCCESS
insert into join_table_large_1 values(16, 16);
SUCCESS
insert into join_table_large_1 values(17, 17);
SUCCESS
insert into join_table_large_1 values(18, 18);
SUCCESS
insert into join_table_large_1 values(19, 19);
SUCCESS
insert into join_table_large_1 values(20, 20);
SUCCESS
insert into join_table_large_1 values(21, 21);
SUCCESS
insert into join_table_large_1 values(22, 22);
SUCCESS
insert into join_table_large_1 values(23, 23);
SUCCESS
insert into join_table_large_1 values(24, 24);
SUCCESS
insert into join_table_large_1 values(25, 25);
SUCCESS
insert into join_table_large_1 values(26, 26);
SUCCESS
insert into join_table_large_1 values(27, 27);
SUCCESS
insert into join_table_large_1 values(28, 28);
SUCCESS
insert into join_table_large_1 values(29, 29);
SUCCESS
insert into join_table_large_1 values(30, 30);
SUCCESS
insert into join_table_large_1 values(31, 31);
SUCCESS
insert into join_table_large_1 values(32, 32);
SUCCESS
insert into join_table_large_1 values(33, 33);
SUCCESS
insert into join_table_large_1 values(34, 34);
SUCCESS
insert into join_table_large_1 values(35, 35);
SUCCESS
insert into join_table_large_1 values(36, 36);
SUCCESS
insert into join_table_large_1 values(37, 37);
SUCCESS
insert into join_table_large_1 values(38, 38);
SUCCESS
insert into join_table_large_1 values(39, 39);
SUCCESS
insert into join_table_large_1 values(40, 40);
SUCCESS
insert into join_table_large_1 values(41, 41);
SUCCESS
insert into join_table_large_1 values(42, 42);
SUCCESS
insert into join_table_large_1 values(43, 43);
SUCCESS
insert into join_table_large_1 values(44, 44);
SUCCESS
insert into join_table_large_1 values(45, 45);
SUCCESS
insert into join_table_large_1 values(46, 46);
SUCCESS
insert into join_table_large_1 values(47, 47);
SUCCESS
insert into join_table_large_1 values(48, 48);
SUCCESS
insert into join_table_large_1 values(49, 49);
SUCCESS
insert into join_table_large_1 values(50, 50);
SUCCESS
insert into join_table_large_1 values(51, 51);
SUCCESS
insert into join_table_large_1 values(52, 52);
SUCCESS
insert into join_table_large_1 values(53, 53);
SUCCESS
insert into join_table_large_1 values(54, 54);
SUCCESS
insert into join_table_large_1 values(55, 55);
SUCCESS
insert into join_table_large_1 values(56, 56);
SUCCESS
insert into join_table_large_1 values(57, 57);
SUCCESS
insert into join_table_large_1 values(58, 58);
SUCCESS
insert into join_table_large_1 values(59, 59);
SUCCESS
insert into join_table_large_1 values(60, 60);
SUCCESS
insert into join_table_large_1 values(61, 61);
SUCCESS
insert into join_table_large_1 values(62, 62);
SUCCESS
insert into join_table_large_1 values(63, 63);
SUCCESS
insert into join_table_large_1 values(64, 64);
SUCCESS
insert into join_table_large_1 values(65, 65);
SUCCESS
insert into join_table_large_1 values(66, 66);
SUCCESS
insert into join_table_large_1 values(67, 67);
SUCCESS
insert into join_table_large_1 values(68, 68);
SUCCESS
insert into join_table_large_1 values(69, 69);
SUCCESS
insert into join_table_large_1 values(70, 70);
SUCCESS
insert into join_table_large_1 values(71, 71);
SUCCESS
insert into join_table_large_1 values(72, 72);
SUCCESS
insert into join_table_large_1 values(73, 73);
SUCCESS
insert into join_table_large_1 values(74, 74);
SUCCESS
insert into join_table_large_1 values(75, 75);
SUCCESS
insert into join_table_large_1 values(76, 76);
SUCCESS
insert into join_table_large_1 values(77, 77);
SUCCESS
insert into join_table_large_1 values(78, 78);
SUCCESS
insert into join_table_large_1 values(79, 79);
SUCCESS
insert into join_table_large_1 values(80, 80);
SUCCESS
insert into join_table_large_1 values(81, 81);
SUCCESS
insert into join_table_large_1 values(82, 82);
SUCCESS
insert into join_table_large_1 values(83, 83);
SUCCESS
insert into join_table_large_1 values(84, 84);
SUCCESS
insert into join_table_large_1 values(85, 85);
SUCCESS
insert into join_table_large_1 values(86, 86);
SUCCESS
insert into join_table_large_1 values(87, 87);
SUCCESS
insert into join_table_large_1 values(88, 88);
SUCCESS
insert into join_table_large_1 values(89, 89);
SUCCESS
insert into join_table_large_1 values(90, 90);
SUCCESS
insert into join_table_large_1 values(91, 91);
SUCCESS
insert into join_table_large_1 values(92, 92);
SUCCESS
insert into join_table_large_1 values(93, 93);
SUCCESS
insert into join_table_large_1 values(94, 94);
SUCCESS
insert into join_table_large_1 values(95, 95);
SUCCESS
insert into join_table_large_1 values(96, 96);
SUCCESS
insert into join_table_large_1 values(97, 97);
SUCCESS
insert into join_table_large_1 values(98, 98);
SUCCESS
insert into join_table_large_1 values(99, 99);
SUCCESS
insert into join_table_large_1 values(100, 100);
SUCCESS
insert into join_table_large_2 values(1, 1);
SUCCESS
insert into join_table_large_2 values(2, 2);
SUCCESS
insert into join_table_large_2 values(3, 3);
SUCCESS
insert into join_table_large_2 values(4, 4);
SUCCESS
insert into join_table_large_2 values(5, 5);
SUCCESS
insert into join_table_large_2 values(6, 6);
SUCCESS
insert into join_table_large_2 values(7, 7);
SUCCESS
insert into join_table_large_2 values(8, 8);
SUCCESS
insert into join_table_large_2 values(9, 9);
SUCCESS
insert into join_table_large_2 values(10, 10);
SUCCESS
insert into join_table_large_2 values(11, 11);
SUCCESS
insert into join_table_large_2 values(12, 12);
SUCCESS
insert into join_table_large_2 values(13, 13);
SUCCESS
insert into join_table_large_2 values(14, 14);
SUCCESS
insert into join_table_large_2 values(15, 15);
SUCCESS
insert into join_table_large_2 values(16, 16);
SUCCESS
insert into join_table_large_2 values(17, 17);
SUCCESS
insert into join_table_large_2 values(18, 18);
SUCCESS
insert into join_table_large_2 values(19, 19);
SUCCESS
insert into join_table_large_2 values(20, 20);
SUCCESS
insert into join_table_large_2 values(21, 21);
SUCCESS
insert into join_table_large_2 values(22, 22);
SUCCESS
insert into join_table_large_2 values(23, 23);
SUCCESS
insert into join_table_large_2 values(24, 24);
SUCCESS
insert into join_table_large_2 values(25, 25);
SUCCESS
insert into join_table_large_2 values(26, 26);
SUCCESS
insert into join_table_large_2 values(27, 27);
SUCCESS
insert into join_table_large_2 values(28, 28);
SUCCESS
insert into join_table_large_2 values(29, 29);
SUCCESS
insert into join_table_large_2 values(30, 30);
SUCCESS
insert into join_table_large_2 values(31, 31);
SUCCESS
insert into join_table_large_2 values(32, 32);
SUCCESS
insert into join_table_large_2 values(33, 33);
SUCCESS
insert into join_table_large_2 values(34, 34);
SUCCESS
insert into join_table_large_2 values(35, 35);
SUCCESS
insert into join_table_large_2 values(36, 36);
SUCCESS
insert into join_table_large_2 values(37, 37);
SUCCESS
insert into join_table_large_2 values(38, 38);
SUCCESS
insert into join_table_large_2 values(39, 39);
SUCCESS
insert into join_table_large_2 values(40, 40);
SUCCESS
insert into join_table_large_2 values(41, 41);
SUCCESS
insert into join_table_large_2 values(42, 42);
SUCCESS
insert into join_table_large_2 values(43, 43);
SUCCESS
insert into join_table_large_2 values(44, 44);
SUCCESS
insert into join_table_large_2 values(45, 45);
SUCCESS
insert into join_table_large_2 values(46, 46);
SUCCESS
insert into join_table_large_2 values(47, 47);
SUCCESS
insert into join_table_large_2 values(48, 48);
SUCCESS
insert into join_table_large_2 values(49, 49);
SUCCESS
insert into join_table_large_2 values(50, 50);
SUCCESS
insert into join_table_large_2 values(51, 51);
SUCCESS
insert into join_table_large_2 values(52, 52);
SUCCESS
insert into join_table_large_2 values(53, 53);
SUCCESS
insert into join_table_large_2 values(54, 54);
SUCCESS
insert into join_table_large_2 values(55, 55);
SUCCESS
insert into join_table_large_2 values(56, 56);
SUCCESS
insert into join_table_large_2 values(57, 57);
SUCCESS
insert into join_table_large_2 values(58, 58);
SUCCESS
insert into join_table_large_2 values(59, 59);
SUCCESS
insert into join_table_large_2 values(60, 60);
SUCCESS
insert into join_table_large_2 values(61, 61);
SUCCESS
insert into join_table_large_2 values(62, 62);
SUCCESS
insert into join_table_large_2 values(63, 63);
SUCCESS
insert into join_table_large_2 values(64, 64);
SUCCESS
insert into join_table_large_2 values(65, 65);
SUCCESS
insert into join_table_large_2 values(66, 66);
SUCCESS
insert into join_table_large_2 values(67, 67);
SUCCESS
insert into join_table_large_2 values(68, 68);
SUCCESS
insert into join_table_large_2 values(69, 69);
SUCCESS
insert into join_table_large_2 values(70, 70);
SUCCESS
insert into join_table_large_2 values(71, 71);
SUCCESS
insert into join_table_large_2 values(72, 72);
SUCCESS
insert into join_table_large_2 values(73, 73);
SUCCESS
insert into join_table_large_2 values(74, 74);
SUCCESS
insert into join_table_large_2 values(75, 75);
SUCCESS
insert into join_table_large_2 values(76, 76);
SUCCESS
insert into join_table_large_2 values(77, 77);
SUCCESS
insert into join_table_large_2 values(78, 78);
SUCCESS
insert into join_table_large_2 values(79, 79);
SUCCESS
insert into join_table_large_2 values(80, 80);
SUCCESS
insert into join_table_large_2 values(81, 81);
SUCCESS
insert into join_table_large_2 values(82, 82);
SUCCESS
insert into join_table_large_2 values(83, 83);
SUCCESS
insert into join_table_large_2 values(84, 84);
SUCCESS
insert into join_table_large_2 values(85, 85);
SUCCESS
insert into join_table_large_2 values(86, 86);
SUCCESS
insert into join_table_large_2 values(87, 87);
SUCCESS
insert into join_table_large_2 values(88, 88);
SUCCESS
insert into join_table_large_2 values(89, 89);
SUCCESS
insert into join_table_large_2 values(90, 90);
SUCCESS
insert into join_table_large_2 values(91, 91);
SUCCESS
insert into join_table_large_2 values(92, 92);
SUCCESS
insert into join_table_large_2 values(93, 93);
SUCCESS
insert into join_table_large_2 values(94, 94);
SUCCESS
insert into join_table_large_2 values(95, 95);
SUCCESS
insert into join_table_large_2 values(96, 96);
SUCCESS
insert into join_table_large_2 values(97, 97);
SUCCESS
insert into join_table_large_2 values(98, 98);
SUCCESS
insert into join_table_large_2 values(99, 99);
SUCCESS
insert into join_table_large_2 values(100, 100);
SUCCESS
insert into join_table_large_3 values(1, 1);
SUCCESS
insert into join_table_large_3 values(2, 2);
SUCCESS
insert into join_table_large_3 values(3, 3);
SUCCESS
insert into join_table_large_3 values(4, 4);
SUCCESS
insert into join_table_large_3 values(5, 5);
SUCCESS
insert into join_table_large_3 values(6, 6);
SUCCESS
insert into join_table_large_3 values(7, 7);
SUCCESS
insert into join_table_large_3 values(8, 8);
SUCCESS
insert into join_table_large_3 values(9, 9);
SUCCESS
insert into join_table_large_3 values(10, 10);
SUCCESS
insert into join_table_large_3 values(11, 11);
SUCCESS
insert into join_table_large_3 values(12, 12);
SUCCESS
insert into join_table_large_3 values(13, 13);
SUCCESS
insert into join_table_large_3 values(14, 14);
SUCCESS
insert into join_table_large_3 values(15, 15);
SUCCESS
insert into join_table_large_3 values(16, 16);
SUCCESS
insert into join_table_large_3 values(17, 17);
SUCCESS
insert into join_table_large_3 values(18, 18);
SUCCESS
insert into join_table_large_3 values(19, 19);
SUCCESS
insert into join_table_large_3 values(20, 20);
SUCCESS
insert into join_table_large_3 values(21, 21);
SUCCESS
insert into join_table_large_3 values(22, 22);
SUCCESS
insert into join_table_large_3 values(23, 23);
SUCCESS
insert into join_table_large_3 values(24, 24);
SUCCESS
insert into join_table_large_3 values(25, 25);
SUCCESS
insert into join_table_large_3 values(26, 26);
SUCCESS
insert into join_table_large_3 values(27, 27);
SUCCESS
insert into join_table_large_3 values(28, 28);
SUCCESS
insert into join_table_large_3 values(29, 29);
SUCCESS
insert into join_table_large_3 values(30, 30);
SUCCESS
insert into join_table_large_3 values(31, 31);
SUCCESS
insert into join_table_large_3 values(32, 32);
SUCCESS
insert into join_table_large_3 values(33, 33);
SUCCESS
insert into join_table_large_3 values(34, 34);
SUCCESS
insert into join_table_large_3 values(35, 35);
SUCCESS
insert into join_table_large_3 values(36, 36);
SUCCESS
insert into join_table_large_3 values(37, 37);
SUCCESS
insert into join_table_large_3 values(38, 38);
SUCCESS
insert into join_table_large_3 values(39, 39);
SUCCESS
insert into join_table_large_3 values(40, 40);
SUCCESS
insert into join_table_large_3 values(41, 41);
SUCCESS
insert into join_table_large_3 values(42, 42);
SUCCESS
insert into join_table_large_3 values(43, 43);
SUCCESS
insert into join_table_large_3 values(44, 44);
SUCCESS
insert into join_table_large_3 values(45, 45);
SUCCESS
insert into join_table_large_3 values(46, 46);
SUCCESS
insert into join_table_large_3 values(47, 47);
SUCCESS
insert into join_table_large_3 values(48, 48);
SUCCESS
insert into join_table_large_3 values(49, 49);
SUCCESS
insert into join_table_large_3 values(50, 50);
SUCCESS
insert into join_table_large_3 values(51, 51);
SUCCESS
insert into join_table_large_3 values(52, 52);
SUCCESS
insert into join_table_large_3 values(53, 53);
SUCCESS
insert into join_table_large_3 values(54, 54);
SUCCESS
insert into join_table_large_3 values(55, 55);
SUCCESS
insert into join_table_large_3 values(56, 56);
SUCCESS
insert into join_table_large_3 values(57, 57);
SUCCESS
insert into join_table_large_3 values(58, 58);
SUCCESS
insert into join_table_large_3 values(59, 59);
SUCCESS
insert into join_table_large_3 values(60, 60);
SUCCESS
insert into join_table_large_3 values(61, 61);
SUCCESS
insert into join_table_large_3 values(62, 62);
SUCCESS
insert into join_table_large_3 values(63, 63);
SUCCESS
insert into join_table_large_3 values(64, 64);
SUCCESS
insert into join_table_large_3 values(65, 65);
SUCCESS
insert into join_table_large_3 values(66, 66);
SUCCESS
insert into join_table_large_3 values(67, 67);
SUCCESS
insert into join_table_large_3 values(68, 68);
SUCCESS
insert into join_table_large_3 values(69, 69);
SUCCESS
insert into join_table_large_3 values(70, 70);
SUCCESS
insert into join_table_large_3 values(71, 71);
SUCCESS
insert into join_table_large_3 values(72, 72);
SUCCESS
insert into join_table_large_3 values(73, 73);
SUCCESS
insert into join_table_large_3 values(74, 74);
SUCCESS
insert into join_table_large_3 values(75, 75);
SUCCESS
insert into join_table_large_3 values(76, 76);
SUCCESS
insert into join_table_large_3 values(77, 77);
SUCCESS
insert into join_table_large_3 values(78, 78);
SUCCESS
insert into join_table_large_3 values(79, 79);
SUCCESS
insert into join_table_large_3 values(80, 80);
SUCCESS
insert into join_table_large_3 values(81, 81);
SUCCESS
insert into join_table_large_3 values(82, 82);
SUCCESS
insert into join_table_large_3 values(83, 83);
SUCCESS
insert into join_table_large_3 values(84, 84);
SUCCESS
insert into join_table_large_3 values(85, 85);
SUCCESS
insert into join_table_large_3 values(86, 86);
SUCCESS
insert into join_table_large_3 values(87, 87);
SUCCESS
insert into join_table_large_3 values(88, 88);
SUCCESS
insert into join_table_large_3 values(89, 89);
SUCCESS
insert into join_table_large_3 values(90, 90);
SUCCESS
insert into join_table_large_3 values(91, 91);
SUCCESS
insert into join_table_large_3 values(92, 92);
SUCCESS
insert into join_table_large_3 values(93, 93);
SUCCESS
insert into join_table_large_3 values(94, 94);
SUCCESS
insert into join_table_large_3 values(95, 95);
SUCCESS
insert into join_table_large_3 values(96, 96);
SUCCESS
insert into join_table_large_3 values(97, 97);
SUCCESS
insert into join_table_large_3 values(98, 98);
SUCCESS
insert into join_table_large_3 values(99, 99);
SUCCESS
insert into join_table_large_3 values(100, 100);
SUCCESS
insert into join_table_large_4 values(1, 1);
SUCCESS
insert into join_table_large_4 values(2, 2);
SUCCESS
insert into join_table_large_4 values(3, 3);
SUCCESS
insert into join_table_large_4 values(4, 4);
SUCCESS
insert into join_table_large_4 values(5, 5);
SUCCESS
insert into join_table_large_4 values(6, 6);
SUCCESS
insert into join_table_large_4 values(7, 7);
SUCCESS
insert into join_table_large_4 values(8, 8);
SUCCESS
insert into join_table_large_4 values(9, 9);
SUCCESS
insert into join_table_large_4 values(10, 10);
SUCCESS
insert into join_table_large_4 values(11, 11);
SUCCESS
insert into join_table_large_4 values(12, 12);
SUCCESS
insert into join_table_large_4 values(13, 13);
SUCCESS
insert into join_table_large_4 values(14, 14);
SUCCESS
insert into join_table_large_4 values(15, 15);
SUCCESS
insert into join_table_large_4 values(16, 16);
SUCCESS
insert into join_table_large_4 values(17, 17);
SUCCESS
insert into join_table_large_4 values(18, 18);
SUCCESS
insert into join_table_large_4 values(19, 19);
SUCCESS
insert into join_table_large_4 values(20, 20);
SUCCESS
insert into join_table_large_4 values(21, 21);
SUCCESS
insert into join_table_large_4 values(22, 22);
SUCCESS
insert into join_table_large_4 values(23, 23);
SUCCESS
insert into join_table_large_4 values(24, 24);
SUCCESS
insert into join_table_large_4 values(25, 25);
SUCCESS
insert into join_table_large_4 values(26, 26);
SUCCESS
insert into join_table_large_4 values(27, 27);
SUCCESS
insert into join_table_large_4 values(28, 28);
SUCCESS
insert into join_table_large_4 values(29, 29);
SUCCESS
insert into join_table_large_4 values(30, 30);
SUCCESS
insert into join_table_large_4 values(31, 31);
SUCCESS
insert into join_table_large_4 values(32, 32);
SUCCESS
insert into join_table_large_4 values(33, 33);
SUCCESS
insert into join_table_large_4 values(34, 34);
SUCCESS
insert into join_table_large_4 values(35, 35);
SUCCESS
insert into join_table_large_4 values(36, 36);
SUCCESS
insert into join_table_large_4 values(37, 37);
SUCCESS
insert into join_table_large_4 values(38, 38);
SUCCESS
insert into join_table_large_4 values(39, 39);
SUCCESS
insert into join_table_large_4 values(40, 40);
SUCCESS
insert into join_table_large_4 values(41, 41);
SUCCESS
insert into join_table_large_4 values(42, 42);
SUCCESS
insert into join_table_large_4 values(43, 43);
SUCCESS
insert into join_table_large_4 values(44, 44);
SUCCESS
insert into join_table_large_4 values(45, 45);
SUCCESS
insert into join_table_large_4 values(46, 46);
SUCCESS
insert into join_table_large_4 values(47, 47);
SUCCESS
insert into join_table_large_4 values(48, 48);
SUCCESS
insert into join_table_large_4 values(49, 49);
SUCCESS
insert into join_table_large_4 values(50, 50);
SUCCESS
insert into join_table_large_4 values(51, 51);
SUCCESS
insert into join_table_large_4 values(52, 52);
SUCCESS
insert into join_table_large_4 values(53, 53);
SUCCESS
insert into join_table_large_4 values(54, 54);
SUCCESS
insert into join_table_large_4 values(55, 55);
SUCCESS
insert into join_table_large_4 values(56, 56);
SUCCESS
insert into join_table_large_4 values(57, 57);
SUCCESS
insert into join_table_large_4 values(58, 58);
SUCCESS
insert into join_table_large_4 values(59, 59);
SUCCESS
insert into join_table_large_4 values(60, 60);
SUCCESS
insert into join_table_large_4 values(61, 61);
SUCCESS
insert into join_table_large_4 values(62, 62);
SUCCESS
insert into join_table_large_4 values(63, 63);
SUCCESS
insert into join_table_large_4 values(64, 64);
SUCCESS
insert into join_table_large_4 values(65, 65);
SUCCESS
insert into join_table_large_4 values(66, 66);
SUCCESS
insert into join_table_large_4 values(67, 67);
SUCCESS
insert into join_table_large_4 values(68, 68);
SUCCESS
insert into join_table_large_4 values(69, 69);
SUCCESS
insert into join_table_large_4 values(70, 70);
SUCCESS
insert into join_table_large_4 values(71, 71);
SUCCESS
insert into join_table_large_4 values(72, 72);
SUCCESS
insert into join_table_large_4 values(73, 73);
SUCCESS
insert into join_table_large_4 values(74, 74);
SUCCESS
insert into join_table_large_4 values(75, 75);
SUCCESS
insert into join_table_large_4 values(76, 76);
SUCCESS
insert into join_table_large_4 values(77, 77);
SUCCESS
insert into join_table_large_4 values(78, 78);
SUCCESS
insert into join_table_large_4 values(79, 79);
SUCCESS
insert into join_table_large_4 values(80, 80);
SUCCESS
insert into join_table_large_4 values(81, 81);
SUCCESS
insert into join_table_large_4 values(82, 82);
SUCCESS
insert into join_table_large_4 values(83, 83);
SUCCESS
insert into join_table_large_4 values(84, 84);
SUCCESS
insert into join_table_large_4 values(85, 85);
SUCCESS
insert into join_table_large_4 values(86, 86);
SUCCESS
insert into join_table_large_4 values(87, 87);
SUCCESS
insert into join_table_large_4 values(88, 88);
SUCCESS
insert into join_table_large_4 values(89, 89);
SUCCESS
insert into join_table_large_4 values(90, 90);
SUCCESS
insert into join_table_large_4 values(91, 91);
SUCCESS
insert into join_table_large_4 values(92, 92);
SUCCESS
insert into join_table_large_4 values(93, 93);
SUCCESS
insert into join_table_large_4 values(94, 94);
SUCCESS
insert into join_table_large_4 values(95, 95);
SUCCESS
insert into join_table_large_4 values(96, 96);
SUCCESS
insert into join_table_large_4 values(97, 97);
SUCCESS
insert into join_table_large_4 values(98, 98);
SUCCESS
insert into join_table_large_4 values(99, 99);
SUCCESS
insert into join_table_large_4 values(100, 100);
SUCCESS
insert into join_table_large_5 values(1, 1);
SUCCESS
insert into join_table_large_5 values(2, 2);
SUCCESS
insert into join_table_large_5 values(3, 3);
SUCCESS
insert into join_table_large_5 values(4, 4);
SUCCESS
insert into join_table_large_5 values(5, 5);
SUCCESS
insert into join_table_large_5 values(6, 6);
SUCCESS
insert into join_table_large_5 values(7, 7);
SUCCESS
insert into join_table_large_5 values(8, 8);
SUCCESS
insert into join_table_large_5 values(9, 9);
SUCCESS
insert into join_table_large_5 values(10, 10);
SUCCESS
insert into join_table_large_5 values(11, 11);
SUCCESS
insert into join_table_large_5 values(12, 12);
SUCCESS
insert into join_table_large_5 values(13, 13);
SUCCESS
insert into join_table_large_5 values(14, 14);
SUCCESS
insert into join_table_large_5 values(15, 15);
SUCCESS
insert into join_table_large_5 values(16, 16);
SUCCESS
insert into join_table_large_5 values(17, 17);
SUCCESS
insert into join_table_large_5 values(18, 18);
SUCCESS
insert into join_table_large_5 values(19, 19);
SUCCESS
insert into join_table_large_5 values(20, 20);
SUCCESS
insert into join_table_large_5 values(21, 21);
SUCCESS
insert into join_table_large_5 values(22, 22);
SUCCESS
insert into join_table_large_5 values(23, 23);
SUCCESS
insert into join_table_large_5 values(24, 24);
SUCCESS
insert into join_table_large_5 values(25, 25);
SUCCESS
insert into join_table_large_5 values(26, 26);
SUCCESS
insert into join_table_large_5 values(27, 27);
SUCCESS
insert into join_table_large_5 values(28, 28);
SUCCESS
insert into join_table_large_5 values(29, 29);
SUCCESS
insert into join_table_large_5 values(30, 30);
SUCCESS
insert into join_table_large_5 values(31, 31);
SUCCESS
insert into join_table_large_5 values(32, 32);
SUCCESS
insert into join_table_large_5 values(33, 33);
SUCCESS
insert into join_table_large_5 values(34, 34);
SUCCESS
insert into join_table_large_5 values(35, 35);
SUCCESS
insert into join_table_large_5 values(36, 36);
SUCCESS
insert into join_table_large_5 values(37, 37);
SUCCESS
insert into join_table_large_5 values(38, 38);
SUCCESS
insert into join_table_large_5 values(39, 39);
SUCCESS
insert into join_table_large_5 values(40, 40);
SUCCESS
insert into join_table_large_5 values(41, 41);
SUCCESS
insert into join_table_large_5 values(42, 42);
SUCCESS
insert into join_table_large_5 values(43, 43);
SUCCESS
insert into join_table_large_5 values(44, 44);
SUCCESS
insert into join_table_large_5 values(45, 45);
SUCCESS
insert into join_table_large_5 values(46, 46);
SUCCESS
insert into join_table_large_5 values(47, 47);
SUCCESS
insert into join_table_large_5 values(48, 48);
SUCCESS
insert into join_table_large_5 values(49, 49);
SUCCESS
insert into join_table_large_5 values(50, 50);
SUCCESS
insert into join_table_large_5 values(51, 51);
SUCCESS
insert into join_table_large_5 values(52, 52);
SUCCESS
insert into join_table_large_5 values(53, 53);
SUCCESS
insert into join_table_large_5 values(54, 54);
SUCCESS
insert into join_table_large_5 values(55, 55);
SUCCESS
insert into join_table_large_5 values(56, 56);
SUCCESS
insert into join_table_large_5 values(57, 57);
SUCCESS
insert into join_table_large_5 values(58, 58);
SUCCESS
insert into join_table_large_5 values(59, 59);
SUCCESS
insert into join_table_large_5 values(60, 60);
SUCCESS
insert into join_table_large_5 values(61, 61);
SUCCESS
insert into join_table_large_5 values(62, 62);
SUCCESS
insert into join_table_large_5 values(63, 63);
SUCCESS
insert into join_table_large_5 values(64, 64);
SUCCESS
insert into join_table_large_5 values(65, 65);
SUCCESS
insert into join_table_large_5 values(66, 66);
SUCCESS
insert into join_table_large_5 values(67, 67);
SUCCESS
insert into join_table_large_5 values(68, 68);
SUCCESS
insert into join_table_large_5 values(69, 69);
SUCCESS
insert into join_table_large_5 values(70, 70);
SUCCESS
insert into join_table_large_5 values(71, 71);
SUCCESS
insert into join_table_large_5 values(72, 72);
SUCCESS
insert into join_table_large_5 values(73, 73);
SUCCESS
insert into join_table_large_5 values(74, 74);
SUCCESS
insert into join_table_large_5 values(75, 75);
SUCCESS
insert into join_table_large_5 values(76, 76);
SUCCESS
insert into join_table_large_5 values(77, 77);
SUCCESS
insert into join_table_large_5 values(78, 78);
SUCCESS
insert into join_table_large_5 values(79, 79);
SUCCESS
insert into join_table_large_5 values(80, 80);
SUCCESS
insert into join_table_large_5 values(81, 81);
SUCCESS
insert into join_table_large_5 values(82, 82);
SUCCESS
insert into join_table_large_5 values(83, 83);
SUCCESS
insert into join_table_large_5 values(84, 84);
SUCCESS
insert into join_table_large_5 values(85, 85);
SUCCESS
insert into join_table_large_5 values(86, 86);
SUCCESS
insert into join_table_large_5 values(87, 87);
SUCCESS
insert into join_table_large_5 values(88, 88);
SUCCESS
insert into join_table_large_5 values(89, 89);
SUCCESS
insert into join_table_large_5 values(90, 90);
SUCCESS
insert into join_table_large_5 values(91, 91);
SUCCESS
insert into join_table_large_5 values(92, 92);
SUCCESS
insert into join_table_large_5 values(93, 93);
SUCCESS
insert into join_table_large_5 values(94, 94);
SUCCESS
insert into join_table_large_5 values(95, 95);
SUCCESS
insert into join_table_large_5 values(96, 96);
SUCCESS
insert into join_table_large_5 values(97, 97);
SUCCESS
insert into join_table_large_5 values(98, 98);
SUCCESS
insert into join_table_large_5 values(99, 99);
SUCCESS
insert into join_table_large_5 values(100, 100);
SUCCESS
insert into join_table_large_6 values(1, 1);
SUCCESS
insert into join_table_large_6 values(2, 2);
SUCCESS
insert into join_table_large_6 values(3, 3);
SUCCESS
insert into join_table_large_6 values(4, 4);
SUCCESS
insert into join_table_large_6 values(5, 5);
SUCCESS
insert into join_table_large_6 values(6, 6);
SUCCESS
insert into join_table_large_6 values(7, 7);
SUCCESS
insert into join_table_large_6 values(8, 8);
SUCCESS
insert into join_table_large_6 values(9, 9);
SUCCESS
insert into join_table_large_6 values(10, 10);
SUCCESS
insert into join_table_large_6 values(11, 11);
SUCCESS
insert into join_table_large_6 values(12, 12);
SUCCESS
insert into join_table_large_6 values(13, 13);
SUCCESS
insert into join_table_large_6 values(14, 14);
SUCCESS
insert into join_table_large_6 values(15, 15);
SUCCESS
insert into join_table_large_6 values(16, 16);
SUCCESS
insert into join_table_large_6 values(17, 17);
SUCCESS
insert into join_table_large_6 values(18, 18);
SUCCESS
insert into join_table_large_6 values(19, 19);
SUCCESS
insert into join_table_large_6 values(20, 20);
SUCCESS
insert into join_table_large_6 values(21, 21);
SUCCESS
insert into join_table_large_6 values(22, 22);
SUCCESS
insert into join_table_large_6 values(23, 23);
SUCCESS
insert into join_table_large_6 values(24, 24);
SUCCESS
insert into join_table_large_6 values(25, 25);
SUCCESS
insert into join_table_large_6 values(26, 26);
SUCCESS
insert into join_table_large_6 values(27, 27);
SUCCESS
insert into join_table_large_6 values(28, 28);
SUCCESS
insert into join_table_large_6 values(29, 29);
SUCCESS
insert into join_table_large_6 values(30, 30);
SUCCESS
insert into join_table_large_6 values(31, 31);
SUCCESS
insert into join_table_large_6 values(32, 32);
SUCCESS
insert into join_table_large_6 values(33, 33);
SUCCESS
insert into join_table_large_6 values(34, 34);
SUCCESS
insert into join_table_large_6 values(35, 35);
SUCCESS
insert into join_table_large_6 values(36, 36);
SUCCESS
insert into join_table_large_6 values(37, 37);
SUCCESS
insert into join_table_large_6 values(38, 38);
SUCCESS
insert into join_table_large_6 values(39, 39);
SUCCESS
insert into join_table_large_6 values(40, 40);
SUCCESS
insert into join_table_large_6 values(41, 41);
SUCCESS
insert into join_table_large_6 values(42, 42);
SUCCESS
insert into join_table_large_6 values(43, 43);
SUCCESS
insert into join_table_large_6 values(44, 44);
SUCCESS
insert into join_table_large_6 values(45, 45);
SUCCESS
insert into join_table_large_6 values(46, 46);
SUCCESS
insert into join_table_large_6 values(47, 47);
SUCCESS
insert into join_table_large_6 values(48, 48);
SUCCESS
insert into join_table_large_6 values(49, 49);
SUCCESS
insert into join_table_large_6 values(50, 50);
SUCCESS
insert into join_table_large_6 values(51, 51);
SUCCESS
insert into join_table_large_6 values(52, 52);
SUCCESS
insert into join_table_large_6 values(53, 53);
SUCCESS
insert into join_table_large_6 values(54, 54);
SUCCESS
insert into join_table_large_6 values(55, 55);
SUCCESS
insert into join_table_large_6 values(56, 56);
SUCCESS
insert into join_table_large_6 values(57, 57);
SUCCESS
insert into join_table_large_6 values(58, 58);
SUCCESS
insert into join_table_large_6 values(59, 59);
SUCCESS
insert into join_table_large_6 values(60, 60);
SUCCESS
insert into join_table_large_6 values(61, 61);
SUCCESS
insert into join_table_large_6 values(62, 62);
SUCCESS
insert into join_table_large_6 values(63, 63);
SUCCESS
insert into join_table_large_6 values(64, 64);
SUCCESS
insert into join_table_large_6 values(65, 65);
SUCCESS
insert into join_table_large_6 values(66, 66);
SUCCESS
insert into join_table_large_6 values(67, 67);
SUCCESS
insert into join_table_large_6 values(68, 68);
SUCCESS
insert into join_table_large_6 values(69, 69);
SUCCESS
insert into join_table_large_6 values(70, 70);
SUCCESS
insert into join_table_large_6 values(71, 71);
SUCCESS
insert into join_table_large_6 values(72, 72);
SUCCESS
insert into join_table_large_6 values(73, 73);
SUCCESS
insert into join_table_large_6 values(74, 74);
SUCCESS
insert into join_table_large_6 values(75, 75);
SUCCESS
insert into join_table_large_6 values(76, 76);
SUCCESS
insert into join_table_large_6 values(77, 77);
SUCCESS
insert into join_table_large_6 values(78, 78);
SUCCESS
insert into join_table_large_6 values(79, 79);
SUCCESS
insert into join_table_large_6 values(80, 80);
SUCCESS
insert into join_table_large_6 values(81, 81);
SUCCESS
insert into join_table_large_6 values(82, 82);
SUCCESS
insert into join_table_large_6 values(83, 83);
SUCCESS
insert into join_table_large_6 values(84, 84);
SUCCESS
insert into join_table_large_6 values(85, 85);
SUCCESS
insert into join_table_large_6 values(86, 86);
SUCCESS
insert into join_table_large_6 values(87, 87);
SUCCESS
insert into join_table_large_6 values(88, 88);
SUCCESS
insert into join_table_large_6 values(89, 89);
SUCCESS
insert into join_table_large_6 values(90, 90);
SUCCESS
insert into join_table_large_6 values(91, 91);
SUCCESS
insert into join_table_large_6 values(92, 92);
SUCCESS
insert into join_table_large_6 values(93, 93);
SUCCESS
insert into join_table_large_6 values(94, 94);
SUCCESS
insert into join_table_large_6 values(95, 95);
SUCCESS
insert into join_table_large_6 values(96, 96);
SUCCESS
insert into join_table_large_6 values(97, 97);
SUCCESS
insert into join_table_large_6 values(98, 98);
SUCCESS
insert into join_table_large_6 values(99, 99);
SUCCESS
insert into join_table_large_6 values(100, 100);
SUCCESS
select * from join_table_large_1 inner join join_table_large_2 on join_table_large_1.id=join_table_large_2.id inner join join_table_large_3 on join_table_large_1.id=join_table_large_3.id inner join join_table_large_4 on join_table_large_3.id=join_table_large_4.id inner join join_table_large_5 on 1=1 inner join join_table_large_6 on join_table_large_5.id=join_table_large_6.id where join_table_large_3.num3 <10 and join_table_large_5.num5>90;
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 100 | 100 | 100 | 100
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 91 | 91 | 91 | 91
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 92 | 92 | 92 | 92
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 93 | 93 | 93 | 93
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 94 | 94 | 94 | 94
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 95 | 95 | 95 | 95
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 96 | 96 | 96 | 96
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 97 | 97 | 97 | 97
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 98 | 98 | 98 | 98
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 99 | 99 | 99 | 99
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 100 | 100 | 100 | 100
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 91 | 91 | 91 | 91
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 92 | 92 | 92 | 92
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 93 | 93 | 93 | 93
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 94 | 94 | 94 | 94
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 95 | 95 | 95 | 95
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 96 | 96 | 96 | 96
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 97 | 97 | 97 | 97
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 98 | 98 | 98 | 98
2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 99 | 99 | 99 | 99
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 100 | 100 | 100 | 100
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 91 | 91 | 91 | 91
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 92 | 92 | 92 | 92
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 93 | 93 | 93 | 93
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 94 | 94 | 94 | 94
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 95 | 95 | 95 | 95
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 96 | 96 | 96 | 96
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 97 | 97 | 97 | 97
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 98 | 98 | 98 | 98
3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 99 | 99 | 99 | 99
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 100 | 100 | 100 | 100
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 91 | 91 | 91 | 91
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 92 | 92 | 92 | 92
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 93 | 93 | 93 | 93
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 94 | 94 | 94 | 94
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 95 | 95 | 95 | 95
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 96 | 96 | 96 | 96
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 97 | 97 | 97 | 97
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 98 | 98 | 98 | 98
4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 99 | 99 | 99 | 99
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 100 | 100 | 100 | 100
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 91 | 91 | 91 | 91
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 92 | 92 | 92 | 92
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 93 | 93 | 93 | 93
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 94 | 94 | 94 | 94
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 95 | 95 | 95 | 95
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 96 | 96 | 96 | 96
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 97 | 97 | 97 | 97
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 98 | 98 | 98 | 98
5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 99 | 99 | 99 | 99
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 100 | 100 | 100 | 100
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 91 | 91 | 91 | 91
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 92 | 92 | 92 | 92
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 93 | 93 | 93 | 93
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 94 | 94 | 94 | 94
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 95 | 95 | 95 | 95
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 96 | 96 | 96 | 96
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 97 | 97 | 97 | 97
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 98 | 98 | 98 | 98
6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 99 | 99 | 99 | 99
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 100 | 100 | 100 | 100
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 91 | 91 | 91 | 91
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 92 | 92 | 92 | 92
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 93 | 93 | 93 | 93
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 94 | 94 | 94 | 94
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 95 | 95 | 95 | 95
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 96 | 96 | 96 | 96
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 97 | 97 | 97 | 97
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 98 | 98 | 98 | 98
7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 99 | 99 | 99 | 99
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 100 | 100 | 100 | 100
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 91 | 91 | 91 | 91
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 92 | 92 | 92 | 92
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 93 | 93 | 93 | 93
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 94 | 94 | 94 | 94
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 95 | 95 | 95 | 95
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 96 | 96 | 96 | 96
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 97 | 97 | 97 | 97
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 98 | 98 | 98 | 98
8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 99 | 99 | 99 | 99
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 100 | 100 | 100 | 100
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 91 | 91 | 91 | 91
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 92 | 92 | 92 | 92
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 93 | 93 | 93 | 93
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 94 | 94 | 94 | 94
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 95 | 95 | 95 | 95
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 96 | 96 | 96 | 96
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 97 | 97 | 97 | 97
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 98 | 98 | 98 | 98
9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 99 | 99 | 99 | 99
JOIN_TABLE_LARGE_1.ID | JOIN_TABLE_LARGE_1.NUM1 | JOIN_TABLE_LARGE_2.ID | JOIN_TABLE_LARGE_2.NUM2 | JOIN_TABLE_LARGE_3.ID | JOIN_TABLE_LARGE_3.NUM3 | JOIN_TABLE_LARGE_4.ID | JOIN_TABLE_LARGE_4.NUM4 | JOIN_TABLE_LARGE_5.ID | JOIN_TABLE_LARGE_5.NUM5 | JOIN_TABLE_LARGE_6.ID | JOIN_TABLE_LARGE_6.NUM6
1. MULTI INDEX OF EMPTY TABLE
CREATE TABLE multi_index(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
SUCCESS
CREATE INDEX i_1_12 ON multi_index(col1,col2);
SUCCESS
CREATE INDEX i_1_345 ON multi_index(col3, col4, col5);
SUCCESS
CREATE INDEX i_1_56 ON multi_index(col5, col6);
SUCCESS
CREATE INDEX i_1_456 ON multi_index(col4, col5, col6);
SUCCESS
SELECT * FROM multi_index;
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
2. MULTI INDEX OF NON-EMPTY TABLE
CREATE TABLE multi_index2(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
SUCCESS
INSERT INTO multi_index2 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
SUCCESS
INSERT INTO multi_index2 VALUES (2, 1, 16.2, 'x', '2021-01-02', 1, 61);
SUCCESS
INSERT INTO multi_index2 VALUES (3, 1, 11.6, 'h', '2023-01-02', 10, 17);
SUCCESS
CREATE INDEX i_2_12 ON multi_index2(col1,col2);
SUCCESS
CREATE INDEX i_2_345 ON multi_index2(col3, col4, col5);
SUCCESS
CREATE INDEX i_2_56 ON multi_index2(col5, col6);
SUCCESS
CREATE INDEX i_2_456 ON multi_index2(col4, col5, col6);
SUCCESS
SELECT * FROM multi_index2;
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
2 | 1 | 16.2 | X | 2021-01-02 | 1 | 61
3 | 1 | 11.6 | H | 2023-01-02 | 10 | 17
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
3. INFLUENCE OF INSERTING
CREATE TABLE multi_index3(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
SUCCESS
CREATE INDEX i_3_i1 ON multi_index3(id,col1);
SUCCESS
INSERT INTO multi_index3 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
SUCCESS
INSERT INTO multi_index3 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
SUCCESS
SELECT * FROM multi_index3;
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
CREATE INDEX i_3_14 ON multi_index3(col1,col4);
SUCCESS
INSERT INTO multi_index3 VALUES (2, 1, 16.2, 'x', '2021-01-02', 1, 61);
SUCCESS
INSERT INTO multi_index3 VALUES (3, 1, 11.6, 'h', '2023-01-02', 10, 17);
SUCCESS
INSERT INTO multi_index3 VALUES (4, 2, 12.2, 'e', '2022-01-04', 13, 10);
SUCCESS
INSERT INTO multi_index3 VALUES (5, 3, 14.2, 'd', '2020-04-02', 12, 2);
SUCCESS
SELECT * FROM multi_index3;
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
2 | 1 | 16.2 | X | 2021-01-02 | 1 | 61
3 | 1 | 11.6 | H | 2023-01-02 | 10 | 17
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
4. QUERY WITH INDEXS
SELECT * FROM multi_index3 WHERE id = 1;
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
SELECT * FROM multi_index3 WHERE col1 > 1 and col4 = '2021-01-02';
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
SELECT * FROM multi_index3 WHERE col1 <> 1 and col4 >= '2021-01-02';
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
SELECT * FROM multi_index3 WHERE col2 < 15.0 and col4 <> '2021-01-02';
3 | 1 | 11.6 | H | 2023-01-02 | 10 | 17
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
5. INFLUENCE OF DELETING
DELETE FROM multi_index3 WHERE id = 1;
SUCCESS
DELETE FROM multi_index3 WHERE id = 61;
SUCCESS
SELECT * FROM multi_index3;
2 | 1 | 16.2 | X | 2021-01-02 | 1 | 61
3 | 1 | 11.6 | H | 2023-01-02 | 10 | 17
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
DELETE FROM multi_index3 WHERE col3 = 'x';
SUCCESS
SELECT * FROM multi_index3;
3 | 1 | 11.6 | H | 2023-01-02 | 10 | 17
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
DELETE FROM multi_index3 WHERE id = 4 and col1 = 1;
SUCCESS
DELETE FROM multi_index3 WHERE id = 90 and col1 = 13;
SUCCESS
DELETE FROM multi_index3 WHERE id = 90 and col1 = 1;
SUCCESS
DELETE FROM multi_index3 WHERE id = 4 and col1 = 13;
SUCCESS
DELETE FROM multi_index3 WHERE id = 3 and col1 = 1;
SUCCESS
DELETE FROM multi_index3 WHERE id = 3 and col1 = 1;
SUCCESS
SELECT * FROM multi_index3;
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
INSERT INTO multi_index3 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
SUCCESS
INSERT INTO multi_index3 VALUES (2, 1, 11.2, 'x', '2021-01-02', 1, 61);
SUCCESS
INSERT INTO multi_index3 VALUES (3, 1, 11.2, 'h', '2023-01-02', 10, 17);
SUCCESS
SELECT * FROM multi_index3;
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
2 | 1 | 11.2 | X | 2021-01-02 | 1 | 61
3 | 1 | 11.2 | H | 2023-01-02 | 10 | 17
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
6. INFLUENCE OF UPDATING
UPDATE multi_index3 SET col6=49 where id=2;
SUCCESS
UPDATE multi_index3 SET col4='1999-02-01' where id=2;
SUCCESS
UPDATE multi_index3 SET col1=2 where id=2;
SUCCESS
UPDATE multi_index3 SET col1=5 where col6=49;
SUCCESS
SELECT * FROM multi_index3;
1 | 1 | 11.2 | A | 2021-01-02 | 1 | 1
2 | 5 | 11.2 | X | 1999-02-01 | 1 | 49
3 | 1 | 11.2 | H | 2023-01-02 | 10 | 17
4 | 2 | 12.2 | E | 2022-01-04 | 13 | 10
5 | 3 | 14.2 | D | 2020-04-02 | 12 | 2
ID | COL1 | COL2 | COL3 | COL4 | COL5 | COL6
7. INFLUENCE OF DROPPING TABLE
DROP table multi_index;
SUCCESS
8. ERROR
CREATE TABLE multi_index4(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
SUCCESS
CREATE INDEX i_4_i7 ON multi_index4(id,col7);
FAILURE
CREATE INDEX i_4_78 ON multi_index4(col7,col8);
FAILURE
CREATE INDEX i_4_i78 ON multi_index4(id,col7,col8);
FAILURE
INITIALIZATION
CREATE TABLE null_table(id int, num int nullable, price float not null, birthday date nullable);
SUCCESS
CREATE TABLE null_table2(id int, num int nullable, price float not null, birthday date nullable);
SUCCESS
CREATE INDEX index_num on null_table(num);
SUCCESS
1. INSERT
INSERT INTO null_table VALUES (1, 18, 10.0, '2020-01-01');
SUCCESS
INSERT INTO null_table VALUES (2, null, 20.0, '2010-01-11');
SUCCESS
INSERT INTO null_table VALUES (3, 12, 30.0, null);
SUCCESS
INSERT INTO null_table VALUES (4, 15, 30.0, '2021-01-31');
SUCCESS
INSERT INTO null_table2 VALUES (1, 18, 30.0, '2021-01-31');
SUCCESS
INSERT INTO null_table2 VALUES (2, null, 40.0, null);
SUCCESS
INSERT INTO null_table VALUES (5, 15, null, '2021-01-31');
FAILURE
INSERT INTO null_table VALUES (null, 15, 30.0, '2021-01-31');
FAILURE
2. SELECT
SELECT * FROM null_table;
1 | 18 | 10 | 2020-01-01
2 | NULL | 20 | 2010-01-11
3 | 12 | 30 | NULL
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
3. SELECT WITH CONSTANT
SELECT * FROM null_table where 1 is null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 1 is not null;
1 | 18 | 10 | 2020-01-01
2 | NULL | 20 | 2010-01-11
3 | 12 | 30 | NULL
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where null=1;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 1=null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 1<>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 1<null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 1>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where null is null;
1 | 18 | 10 | 2020-01-01
2 | NULL | 20 | 2010-01-11
3 | 12 | 30 | NULL
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where null is not null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE null=null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE null<>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE null>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE null<null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 'a' is null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where 'a' is not null;
1 | 18 | 10 | 2020-01-01
2 | NULL | 20 | 2010-01-11
3 | 12 | 30 | NULL
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE null='a';
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE 'a'=null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE 'a'<>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE 'a'>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE 'a'<null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where '2021-01-31' is null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where '2021-01-31' is not null;
1 | 18 | 10 | 2020-01-01
2 | NULL | 20 | 2010-01-11
3 | 12 | 30 | NULL
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE null='2021-01-31';
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE '2021-01-31'=null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE '2021-01-31'>null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table WHERE '2021-01-31'<null;
ID | NUM | PRICE | BIRTHDAY
4. SELECT WITH COLUMN
SELECT * FROM null_table where birthday is not null;
1 | 18 | 10 | 2020-01-01
2 | NULL | 20 | 2010-01-11
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where birthday is null;
3 | 12 | 30 | NULL
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where birthday = null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where null = birthday;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where birthday <> null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where birthday > null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where birthday < null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where num is not null;
1 | 18 | 10 | 2020-01-01
3 | 12 | 30 | NULL
4 | 15 | 30 | 2021-01-31
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where num is null;
2 | NULL | 20 | 2010-01-11
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where num = null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where null = num;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where num <> null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where num > null;
ID | NUM | PRICE | BIRTHDAY
SELECT * FROM null_table where num < null;
ID | NUM | PRICE | BIRTHDAY
SELECT null_table.num,null_table2.num,null_table.birthday FROM null_table,null_table2 where null_table.num=null_table2.num;
18 | 18 | 2020-01-01
NULL_TABLE.NUM | NULL_TABLE2.NUM | NULL_TABLE.BIRTHDAY
5. AGGREGATION
SELECT count(*) FROM null_table;
COUNT(*)
4
SELECT count(price) FROM null_table;
COUNT(PRICE)
4
SELECT count(birthday) FROM null_table;
COUNT(BIRTHDAY)
3
SELECT avg(num) FROM null_table;
AVG(NUM)
15
6. AGGREGATION WITH NULL COLUMNS
CREATE TABLE null_table3(id int, num int nullable);
SUCCESS
INSERT INTO null_table3 VALUES (1, null);
SUCCESS
INSERT INTO null_table3 VALUES (2, null);
SUCCESS
SELECT count(num) FROM null_table3;
COUNT(NUM)
0
SELECT min(num) FROM null_table3;
MIN(NUM)
NULL
SELECT max(num) FROM null_table3;
MAX(NUM)
NULL
SELECT avg(num) FROM null_table3;
AVG(NUM)
NULL
1. CREATE TABLE
create table t_order_by(id int, score float, name char);
SUCCESS
create table t_order_by_2(id int, age int);
SUCCESS
2. INSERT RECORDS
insert into t_order_by values(3, 1.0, 'a');
SUCCESS
insert into t_order_by values(1, 2.0, 'b');
SUCCESS
insert into t_order_by values(4, 3.0, 'c');
SUCCESS
insert into t_order_by values(3, 2.0, 'c');
SUCCESS
insert into t_order_by values(3, 4.0, 'c');
SUCCESS
insert into t_order_by values(3, 3.0, 'd');
SUCCESS
insert into t_order_by values(3, 2.0, 'f');
SUCCESS
insert into t_order_by_2 values(1, 10);
SUCCESS
insert into t_order_by_2 values(2, 20);
SUCCESS
insert into t_order_by_2 values(3, 10);
SUCCESS
insert into t_order_by_2 values(3, 20);
SUCCESS
insert into t_order_by_2 values(3, 40);
SUCCESS
insert into t_order_by_2 values(4, 20);
SUCCESS
3. PRIMARY ORDER BY
select * from t_order_by order by id;
1 | 2 | B
3 | 1 | A
3 | 2 | C
3 | 2 | F
3 | 3 | D
3 | 4 | C
4 | 3 | C
ID | SCORE | NAME
select * from t_order_by order by id asc;
1 | 2 | B
3 | 1 | A
3 | 2 | C
3 | 2 | F
3 | 3 | D
3 | 4 | C
4 | 3 | C
ID | SCORE | NAME
select * from t_order_by order by id desc;
1 | 2 | B
3 | 1 | A
3 | 2 | C
3 | 2 | F
3 | 3 | D
3 | 4 | C
4 | 3 | C
ID | SCORE | NAME
select * from t_order_by order by score desc;
1 | 2 | B
3 | 1 | A
3 | 2 | C
3 | 2 | F
3 | 3 | D
3 | 4 | C
4 | 3 | C
ID | SCORE | NAME
select * from t_order_by order by name desc;
1 | 2 | B
3 | 1 | A
3 | 2 | C
3 | 2 | F
3 | 3 | D
3 | 4 | C
4 | 3 | C
ID | SCORE | NAME
4. ORDER BY MORE THAN ONE FIELDS
select * from t_order_by order by id, score, name;
ID | SCORE | NAME
1 | 2 | B
3 | 1 | A
3 | 2 | C
3 | 2 | F
3 | 3 | D
3 | 4 | C
4 | 3 | C
select * from t_order_by order by id desc, score asc, name desc;
ID | SCORE | NAME
4 | 3 | C
3 | 1 | A
3 | 2 | F
3 | 2 | C
3 | 3 | D
3 | 4 | C
1 | 2 | B
5. ORDER BY ASSOCIATE WITH WHERE CONDITION
select * from t_order_by where id=3 and name>='a' order by score desc, name;
ID | SCORE | NAME
3 | 4 | C
3 | 3 | D
3 | 2 | C
3 | 2 | F
3 | 1 | A
6. MULTI-TABLE ORDER BY
select * from t_order_by,t_order_by_2 order by t_order_by.id,t_order_by.score,t_order_by.name,t_order_by_2.id,t_order_by_2.age;
T_ORDER_BY.ID | T_ORDER_BY.SCORE | T_ORDER_BY.NAME | T_ORDER_BY_2.ID | T_ORDER_BY_2.AGE
1 | 2 | B | 1 | 10
1 | 2 | B | 2 | 20
1 | 2 | B | 3 | 10
1 | 2 | B | 3 | 20
1 | 2 | B | 3 | 40
1 | 2 | B | 4 | 20
3 | 1 | A | 1 | 10
3 | 1 | A | 2 | 20
3 | 1 | A | 3 | 10
3 | 1 | A | 3 | 20
3 | 1 | A | 3 | 40
3 | 1 | A | 4 | 20
3 | 2 | C | 1 | 10
3 | 2 | C | 2 | 20
3 | 2 | C | 3 | 10
3 | 2 | C | 3 | 20
3 | 2 | C | 3 | 40
3 | 2 | C | 4 | 20
3 | 2 | F | 1 | 10
3 | 2 | F | 2 | 20
3 | 2 | F | 3 | 10
3 | 2 | F | 3 | 20
3 | 2 | F | 3 | 40
3 | 2 | F | 4 | 20
3 | 3 | D | 1 | 10
3 | 3 | D | 2 | 20
3 | 3 | D | 3 | 10
3 | 3 | D | 3 | 20
3 | 3 | D | 3 | 40
3 | 3 | D | 4 | 20
3 | 4 | C | 1 | 10
3 | 4 | C | 2 | 20
3 | 4 | C | 3 | 10
3 | 4 | C | 3 | 20
3 | 4 | C | 3 | 40
3 | 4 | C | 4 | 20
4 | 3 | C | 1 | 10
4 | 3 | C | 2 | 20
4 | 3 | C | 3 | 10
4 | 3 | C | 3 | 20
4 | 3 | C | 3 | 40
4 | 3 | C | 4 | 20
select * from t_order_by, t_order_by_2 where t_order_by.id=t_order_by_2.id order by t_order_by.score desc, t_order_by_2.age asc, t_order_by.id asc, t_order_by.name;
T_ORDER_BY.ID | T_ORDER_BY.SCORE | T_ORDER_BY.NAME | T_ORDER_BY_2.ID | T_ORDER_BY_2.AGE
3 | 4 | C | 3 | 10
3 | 4 | C | 3 | 20
3 | 4 | C | 3 | 40
3 | 3 | D | 3 | 10
3 | 3 | D | 3 | 20
4 | 3 | C | 4 | 20
3 | 3 | D | 3 | 40
1 | 2 | B | 1 | 10
3 | 2 | C | 3 | 10
3 | 2 | F | 3 | 10
3 | 2 | C | 3 | 20
3 | 2 | F | 3 | 20
3 | 2 | C | 3 | 40
3 | 2 | F | 3 | 40
3 | 1 | A | 3 | 10
3 | 1 | A | 3 | 20
3 | 1 | A | 3 | 40
INITIALIZATION
CREATE TABLE Select_meta(id int, age int);
SUCCESS
1. SELECT FROM A NON-EXISTENT TABLE
select * from no_table;
FAILURE
2. SELECT FROM A NON-EXISTENT COLUMN
select home from Select_meta;
FAILURE
select * from Select_meta where home='001';
FAILURE
INITIALIZATION
CREATE TABLE Select_tables_1(id int, age int, u_name char);
SUCCESS
CREATE TABLE Select_tables_2(id int, age int, u_name char);
SUCCESS
CREATE TABLE Select_tables_3(id int, res int, u_name char);
SUCCESS
CREATE TABLE Select_tables_4(id int, age int, u_name char);
SUCCESS
CREATE TABLE Select_tables_5(id int, res int, u_name char);
SUCCESS
INSERT INTO Select_tables_1 VALUES (1,18,'a');
SUCCESS
INSERT INTO Select_tables_1 VALUES (2,15,'b');
SUCCESS
INSERT INTO Select_tables_2 VALUES (1,20,'a');
SUCCESS
INSERT INTO Select_tables_2 VALUES (2,21,'c');
SUCCESS
INSERT INTO Select_tables_3 VALUES (1,35,'a');
SUCCESS
INSERT INTO Select_tables_3 VALUES (2,37,'a');
SUCCESS
INSERT DATA INTO SELECT_TABLES_4 AND SELECT_TABLES_5
INSERT INTO Select_tables_4 VALUES (1, 2, 'a');
SUCCESS
INSERT INTO Select_tables_4 VALUES (1, 3, 'b');
SUCCESS
INSERT INTO Select_tables_4 VALUES (2, 2, 'c');
SUCCESS
INSERT INTO Select_tables_4 VALUES (2, 4, 'd');
SUCCESS
INSERT INTO Select_tables_5 VALUES (1, 10, 'g');
SUCCESS
INSERT INTO Select_tables_5 VALUES (1, 11, 'f');
SUCCESS
INSERT INTO Select_tables_5 VALUES (2, 12, 'c');
SUCCESS
1. MULTI-TABLE QUERY
SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3;
1 | 18 | A | 1 | 20 | A | 1 | 35 | A
1 | 18 | A | 1 | 20 | A | 2 | 37 | A
1 | 18 | A | 2 | 21 | C | 1 | 35 | A
1 | 18 | A | 2 | 21 | C | 2 | 37 | A
2 | 15 | B | 1 | 20 | A | 1 | 35 | A
2 | 15 | B | 1 | 20 | A | 2 | 37 | A
2 | 15 | B | 2 | 21 | C | 1 | 35 | A
2 | 15 | B | 2 | 21 | C | 2 | 37 | A
SELECT_TABLES_1.ID | SELECT_TABLES_1.AGE | SELECT_TABLES_1.U_NAME | SELECT_TABLES_2.ID | SELECT_TABLES_2.AGE | SELECT_TABLES_2.U_NAME | SELECT_TABLES_3.ID | SELECT_TABLES_3.RES | SELECT_TABLES_3.U_NAME
SELECT Select_tables_1.id,Select_tables_2.u_name,Select_tables_3.res FROM Select_tables_1,Select_tables_2,Select_tables_3;
1 | A | 35
1 | A | 37
1 | C | 35
1 | C | 37
2 | A | 35
2 | A | 37
2 | C | 35
2 | C | 37
SELECT_TABLES_1.ID | SELECT_TABLES_2.U_NAME | SELECT_TABLES_3.RES
Select Select_tables_1.res FROM Select_tables_1,Select_tables_2,Select_tables_3;
FAILURE
2. CONDITIONAL QUERY
SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3 WHERE Select_tables_1.u_name=Select_tables_2.u_name AND Select_tables_2.u_name=Select_tables_3.u_name;
1 | 18 | A | 1 | 20 | A | 1 | 35 | A
1 | 18 | A | 1 | 20 | A | 2 | 37 | A
SELECT_TABLES_1.ID | SELECT_TABLES_1.AGE | SELECT_TABLES_1.U_NAME | SELECT_TABLES_2.ID | SELECT_TABLES_2.AGE | SELECT_TABLES_2.U_NAME | SELECT_TABLES_3.ID | SELECT_TABLES_3.RES | SELECT_TABLES_3.U_NAME
SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3 WHERE Select_tables_1.id=Select_tables_2.id AND Select_tables_3.res=35;
1 | 18 | A | 1 | 20 | A | 1 | 35 | A
2 | 15 | B | 2 | 21 | C | 1 | 35 | A
SELECT_TABLES_1.ID | SELECT_TABLES_1.AGE | SELECT_TABLES_1.U_NAME | SELECT_TABLES_2.ID | SELECT_TABLES_2.AGE | SELECT_TABLES_2.U_NAME | SELECT_TABLES_3.ID | SELECT_TABLES_3.RES | SELECT_TABLES_3.U_NAME
SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3 WHERE Select_tables_1.age<18 AND Select_tables_2.u_name='c' AND Select_tables_3.res=35 AND Select_tables_1.id=Select_tables_2.id AND Select_tables_2.id=Select_tables_3.id;
SELECT_TABLES_1.ID | SELECT_TABLES_1.AGE | SELECT_TABLES_1.U_NAME | SELECT_TABLES_2.ID | SELECT_TABLES_2.AGE | SELECT_TABLES_2.U_NAME | SELECT_TABLES_3.ID | SELECT_TABLES_3.RES | SELECT_TABLES_3.U_NAME
SELECT Select_tables_2.age FROM Select_tables_1,Select_tables_2 WHERE Select_tables_1.age<18 AND Select_tables_2.u_name='c' AND Select_tables_1.id=Select_tables_2.id;
21
SELECT_TABLES_2.AGE
3. DUPLICATE KEY QUERY
SELECT * from Select_tables_4, Select_tables_5 where Select_tables_4.id=Select_tables_5.id;
1 | 2 | A | 1 | 10 | G
1 | 2 | A | 1 | 11 | F
1 | 3 | B | 1 | 10 | G
1 | 3 | B | 1 | 11 | F
2 | 2 | C | 2 | 12 | C
2 | 4 | D | 2 | 12 | C
SELECT_TABLES_4.ID | SELECT_TABLES_4.AGE | SELECT_TABLES_4.U_NAME | SELECT_TABLES_5.ID | SELECT_TABLES_5.RES | SELECT_TABLES_5.U_NAME
select * from Select_tables_4, Select_tables_5 where Select_tables_4.id >= Select_tables_5.id;
1 | 2 | A | 1 | 10 | G
1 | 2 | A | 1 | 11 | F
1 | 3 | B | 1 | 10 | G
1 | 3 | B | 1 | 11 | F
2 | 2 | C | 1 | 10 | G
2 | 2 | C | 1 | 11 | F
2 | 2 | C | 2 | 12 | C
2 | 4 | D | 1 | 10 | G
2 | 4 | D | 1 | 11 | F
2 | 4 | D | 2 | 12 | C
SELECT_TABLES_4.ID | SELECT_TABLES_4.AGE | SELECT_TABLES_4.U_NAME | SELECT_TABLES_5.ID | SELECT_TABLES_5.RES | SELECT_TABLES_5.U_NAME
4. JOIN EMPTY TABLE
CREATE TABLE Select_tables_6(id int, res int);
SUCCESS
SELECT Select_tables_1.id,Select_tables_6.id from Select_tables_1, Select_tables_6 where Select_tables_1.id=Select_tables_6.id;
SELECT_TABLES_1.ID | SELECT_TABLES_6.ID
INITIALIZATION
CREATE TABLE ssq_1(id int, col1 int, feat1 float);
SUCCESS
CREATE TABLE ssq_2(id int, col2 int, feat2 float);
SUCCESS
CREATE TABLE ssq_3(id int, col3 int, feat3 float);
SUCCESS
INSERT INTO ssq_1 VALUES (1, 4, 11.2);
SUCCESS
INSERT INTO ssq_1 VALUES (2, 2, 12.0);
SUCCESS
INSERT INTO ssq_1 VALUES (3, 3, 13.5);
SUCCESS
INSERT INTO ssq_2 VALUES (1, 2, 13.0);
SUCCESS
INSERT INTO ssq_2 VALUES (2, 7, 10.5);
SUCCESS
INSERT INTO ssq_2 VALUES (5, 3, 12.6);
SUCCESS
1. SELECT
select * from ssq_1 where id in (select ssq_2.id from ssq_2);
1 | 4 | 11.2
2 | 2 | 12
ID | COL1 | FEAT1
select * from ssq_1 where col1 not in (select ssq_2.col2 from ssq_2);
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from ssq_1 where col1 = (select avg(ssq_2.col2) from ssq_2);
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from ssq_1 where (select avg(ssq_2.col2) from ssq_2) = col1;
1 | 4 | 11.2
ID | COL1 | FEAT1
select * from ssq_1 where feat1 >= (select min(ssq_2.feat2) from ssq_2);
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from ssq_1 where (select min(ssq_2.feat2) from ssq_2) <= feat1;
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from ssq_1 where feat1 <= (select max(ssq_2.feat2) from ssq_2);
1 | 4 | 11.2
2 | 2 | 12
ID | COL1 | FEAT1
select * from ssq_1 where (select max(ssq_2.feat2) from ssq_2) >= feat1;
1 | 4 | 11.2
2 | 2 | 12
ID | COL1 | FEAT1
select * from ssq_1 where feat1 > (select min(ssq_2.feat2) from ssq_2);
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from ssq_1 where (select min(ssq_2.feat2) from ssq_2) < feat1;
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from ssq_1 where feat1 < (select max(ssq_2.feat2) from ssq_2);
1 | 4 | 11.2
2 | 2 | 12
ID | COL1 | FEAT1
select * from ssq_1 where (select max(ssq_2.feat2) from ssq_2) > feat1;
1 | 4 | 11.2
2 | 2 | 12
ID | COL1 | FEAT1
select * from ssq_1 where feat1 <> (select avg(ssq_2.feat2) from ssq_2);
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
2. SELECT WITH EMPTY TABLE
select * from ssq_1 where feat1 < (select max(ssq_2.feat2) from ssq_2 where 1=0);
ID | COL1 | FEAT1
select * from ssq_1 where id in (select ssq_2.id from ssq_2 where 1=0);
ID | COL1 | FEAT1
select * from ssq_1 where id not in (select ssq_2.id from ssq_2 where 1=0);
1 | 4 | 11.2
2 | 2 | 12
3 | 3 | 13.5
ID | COL1 | FEAT1
select * from ssq_3 where feat3 < (select max(ssq_2.feat2) from ssq_2);
ID | COL3 | FEAT3
select * from ssq_3 where id in (select ssq_2.id from ssq_2);
ID | COL3 | FEAT3
select * from ssq_3 where id not in (select ssq_2.id from ssq_2);
ID | COL3 | FEAT3
3. ERROR
select * from ssq_1 where col1 = (select ssq_2.col2 from ssq_2);
FAILURE
select * from ssq_1 where col1 = (select * from ssq_2);
FAILURE
select * from ssq_1 where col1 in (select * from ssq_2);
FAILURE
select * from ssq_1 where col1 not in (select * from ssq_2);
FAILURE
INITIALIZATION
create table text_table(id int, info text);
SUCCESS
1. INSERT
insert into text_table values (1,'this is a very very long string');
SUCCESS
insert into text_table values (2,'this is a very very long string2');
SUCCESS
insert into text_table values (3,'this is a very very long string3');
SUCCESS
select * from text_table;
1 | THIS IS A VERY VERY LONG STRING
2 | THIS IS A VERY VERY LONG STRING2
3 | THIS IS A VERY VERY LONG STRING3
ID | INFO
2. CONDITION
delete from text_table where id=1;
SUCCESS
select * from text_table;
2 | THIS IS A VERY VERY LONG STRING2
3 | THIS IS A VERY VERY LONG STRING3
ID | INFO
3. UPDATE
UPDATE text_table set info='a tmp data' where id = 2;
SUCCESS
select * from text_table;
2 | A TMP DATA
3 | THIS IS A VERY VERY LONG STRING3
ID | INFO
4. BOUNDARY TEST WITH LENGTH 4096
insert into text_table values (4,'this is a very very long string pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad1');
SUCCESS
select * from text_table;
2 | A TMP DATA
3 | THIS IS A VERY VERY LONG STRING3
4 | THIS IS A VERY VERY LONG STRING PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD1
ID | INFO
insert into text_table values (5,'this is a very very long string pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad1 pad pad pad pad');
SUCCESS
select * from text_table;
2 | A TMP DATA
3 | THIS IS A VERY VERY LONG STRING3
4 | THIS IS A VERY VERY LONG STRING PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD1
5 | THIS IS A VERY VERY LONG STRING PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD PAD1
ID | INFO
INITIALIZATION
CREATE TABLE unique_table(id int, col1 int, col2 int);
SUCCESS
INSERT INTO unique_table VALUES (1,1,1);
SUCCESS
1. UNIQUE TEST
CREATE UNIQUE INDEX index_id on unique_table(id);
SUCCESS
INSERT INTO unique_table VALUES (2,1,1);
SUCCESS
CREATE UNIQUE INDEX index_id on unique_table(id);
FAILURE
INSERT INTO unique_table VALUES (3,2,1);
SUCCESS
INSERT INTO unique_table VALUES (1,2,1);
FAILURE
2. SELECT
SELECT * FROM unique_table;
1 | 1 | 1
2 | 1 | 1
3 | 2 | 1
ID | COL1 | COL2
INITIALIZATION
CREATE TABLE Update_table_1(id int, t_name char, col1 int, col2 int);
SUCCESS
CREATE INDEX index_id on Update_table_1(id);
SUCCESS
INSERT INTO Update_table_1 VALUES (1,'N1',1,1);
SUCCESS
INSERT INTO Update_table_1 VALUES (2,'N2',1,1);
SUCCESS
INSERT INTO Update_table_1 VALUES (3,'N3',2,1);
SUCCESS
1. UPDATE A ROW
UPDATE Update_table_1 SET t_name='N01' WHERE id=1;
SUCCESS
SELECT * FROM Update_table_1;
1 | N01 | 1 | 1
2 | N2 | 1 | 1
3 | N3 | 2 | 1
ID | T_NAME | COL1 | COL2
2. UPDATE ROWS
UPDATE Update_table_1 SET col2=0 WHERE col1=1;
SUCCESS
SELECT * FROM Update_table_1;
1 | N01 | 1 | 0
2 | N2 | 1 | 0
3 | N3 | 2 | 1
ID | T_NAME | COL1 | COL2
3. UPDATE A INDEX COLUMN
UPDATE Update_table_1 SET id=4 WHERE t_name='N3';
SUCCESS
SELECT * FROM Update_table_1;
1 | N01 | 1 | 0
2 | N2 | 1 | 0
4 | N3 | 2 | 1
ID | T_NAME | COL1 | COL2
4. UPDATE WITHOUT CONDITIONS
UPDATE Update_table_1 SET col1=0;
SUCCESS
SELECT * FROM Update_table_1;
1 | N01 | 0 | 0
2 | N2 | 0 | 0
4 | N3 | 0 | 1
ID | T_NAME | COL1 | COL2
5. UPDATE WITH CONDITIONS
UPDATE Update_table_1 SET t_name='N02' WHERE col1=0 AND col2=0;
SUCCESS
SELECT * FROM Update_table_1;
1 | N02 | 0 | 0
2 | N02 | 0 | 0
4 | N3 | 0 | 1
ID | T_NAME | COL1 | COL2
6. UPDATE NON-EXISTENT TABLE
UPDATE Update_table_2 SET t_name='N01' WHERE id=1;
FAILURE
7. UPDATE NON-EXISTENT COLUMN
UPDATE Update_table_1 SET t_name_false='N01' WHERE id=1;
FAILURE
8. UPDATE WITH INVALID CONDITION
UPDATE Update_table_1 SET t_name='N01' WHERE id_false=1;
FAILURE
9. UPDATE IN VAIN
UPDATE Update_table_1 SET t_name='N01' WHERE id=100;
SUCCESS
SELECT * FROM Update_table_1;
1 | N02 | 0 | 0
2 | N02 | 0 | 0
4 | N3 | 0 | 1
ID | T_NAME | COL1 | COL2
10. UPDATE WITH INVALID VALUE
UPDATE Update_table_1 SET col1='N01' WHERE id=1;
FAILURE
-- echo basic insert
create table t_basic(id int, age int, name char, score float);
insert into t_basic values(1,1, 'a', 1.0);
insert into t_basic values(2,2, 'b', 2.0);
insert into t_basic values(4,4, 'c', 3.0);
insert into t_basic values(3,3, 'd', 4.0);
insert into t_basic values(5,5, 'e', 5.5);
insert into t_basic values(6,6, 'f', 6.6);
insert into t_basic values(7,7, 'g', 7.7);
--sort select * from t_basic;
-- echo basic delete
delete from t_basic where id=3;
-- sort select * from t_basic;
-- echo basic select
select * from t_basic where id=1;
-- sort select * from t_basic where id>=5;
select * from t_basic where age>1 and age<3;
select * from t_basic where t_basic.id=1 and t_basic.age=1;
select * from t_basic where id=1 and age=1;
-- sort select id, age, name, score from t_basic;
-- sort select t_basic.id, t_basic.age, t_basic.name, t_basic.score from t_basic;
-- sort select t_basic.id, t_basic.age, name from t_basic;
-- echo create index
create index i_id on t_basic (id);
-- sort select * from t_basic;
-- echo initialization
CREATE TABLE aggregation_func(id int, num int, price float, addr char, birthday date);
INSERT INTO aggregation_func VALUES (1, 18, 10.0, 'abc', '2020-01-01');
INSERT INTO aggregation_func VALUES (2, 15, 20.0, 'abc', '2010-01-11');
INSERT INTO aggregation_func VALUES (3, 12, 30.0, 'def', '2021-01-21');
INSERT INTO aggregation_func VALUES (4, 15, 30.0, 'dei', '2021-01-31');
-- echo 1. count
SELECT count(*) FROM aggregation_func;
SELECT count(num) FROM aggregation_func;
-- echo 2. min
SELECT min(num) FROM aggregation_func;
SELECT min(price) FROM aggregation_func;
SELECT min(addr) FROM aggregation_func;
-- echo 3. max
SELECT max(num) FROM aggregation_func;
SELECT max(price) FROM aggregation_func;
SELECT max(addr) FROM aggregation_func;
-- echo 4. avg
SELECT avg(num) FROM aggregation_func;
SELECT avg(price) FROM aggregation_func;
-- echo 5. error with *
SELECT min(*) FROM aggregation_func;
SELECT max(*) FROM aggregation_func;
SELECT avg(*) FROM aggregation_func;
-- echo 6. error with redundant columns
SELECT count(*,num) FROM aggregation_func;
SELECT min(num,price) FROM aggregation_func;
SELECT max(num,price) FROM aggregation_func;
SELECT avg(num,price) FROM aggregation_func;
-- echo 7. error with empty columns
SELECT count() FROM aggregation_func;
SELECT min() FROM aggregation_func;
SELECT max() FROM aggregation_func;
SELECT avg() FROM aggregation_func;
-- echo 8. error with non-existent columns
SELECT count(id2) FROM aggregation_func;
SELECT min(id2) FROM aggregation_func;
SELECT max(id2) FROM aggregation_func;
SELECT avg(id2) FROM aggregation_func;
-- echo 9. select many aggregation
SELECT min(num),max(num),avg(num) FROM aggregation_func;
-- echo initialization
CREATE TABLE csq_1(id int, col1 int, feat1 float);
CREATE TABLE csq_2(id int, col2 int, feat2 float);
CREATE TABLE csq_3(id int, col3 int, feat3 float);
CREATE TABLE csq_4(id int, col4 int, feat4 float);
INSERT INTO csq_1 VALUES (1, 4, 11.2);
INSERT INTO csq_1 VALUES (2, 2, 12.0);
INSERT INTO csq_1 VALUES (3, 3, 13.5);
INSERT INTO csq_2 VALUES (1, 2, 13.0);
INSERT INTO csq_2 VALUES (2, 7, 10.5);
INSERT INTO csq_2 VALUES (5, 3, 12.6);
INSERT INTO csq_3 VALUES (1, 2, 11.0);
INSERT INTO csq_3 VALUES (3, 6, 16.5);
INSERT INTO csq_3 VALUES (5, 5, 14.6);
-- echo 1. Select
-- sort select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id in (select csq_3.id from csq_3));
-- sort select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id not in (select csq_3.id from csq_3));
-- sort select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id not in (select csq_3.id from csq_3));
-- sort select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id in (select csq_3.id from csq_3));
-- sort select * from csq_1 where col1 > (select avg(csq_2.col2) from csq_2 where csq_2.feat2 >= (select min(csq_3.feat3) from csq_3));
-- sort select * from csq_1 where (select avg(csq_2.col2) from csq_2 where csq_2.feat2 > (select min(csq_3.feat3) from csq_3)) = col1;
-- sort select * from csq_1 where (select avg(csq_2.col2) from csq_2) <> (select avg(csq_3.col3) from csq_3);
-- sort select * from csq_1 where feat1 > (select min(csq_2.feat2) from csq_2) and col1 <= (select min(csq_3.col3) from csq_3);
-- sort select * from csq_1 where (select max(csq_2.feat2) from csq_2) > feat1 and col1 > (select min(csq_3.col3) from csq_3);
-- sort select * from csq_1 where (select max(csq_2.feat2) from csq_2) > feat1 and (select min(csq_3.col3) from csq_3) < col1;
-- sort select * from csq_1 where feat1 <> (select avg(csq_2.feat2) from csq_2 where csq_2.feat2 > csq_1.feat1);
-- sort select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id in (select csq_3.id from csq_3 where csq_1.id = csq_3.id));
-- echo 2. Select with empty table
-- sort select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id in (select csq_3.id from csq_3 where 1=0));
-- sort select * from csq_1 where id in (select csq_2.id from csq_2 where csq_2.id in (select csq_3.id from csq_3 where 1=0) and 1=0);
-- sort select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id not in (select csq_3.id from csq_3 where 1=0));
-- sort select * from csq_1 where col1 not in (select csq_2.col2 from csq_2 where csq_2.id not in (select csq_3.id from csq_3) and 1=0);
-- sort select * from csq_3 where feat3 < (select max(csq_2.feat2) from csq_2 where csq_2.id not in (select csq_3.id from csq_3 where 1=0));
-- sort select * from csq_3 where feat3 < (select max(csq_2.feat2) from csq_2 where csq_2.id not in (select csq_3.id from csq_3 ) and 1=0);
--echo 3. error
select * from csq_1 where col1 = (select csq_2.col2 from csq_2);
select * from csq_1 where col1 = (select * from csq_2);
select * from csq_1 where col1 in (select * from csq_2);
select * from csq_1 where col1 not in (select * from csq_2);
-- echo initialization
CREATE TABLE date_table(id int, u_date date);
CREATE INDEX index_id on date_table(u_date);
-- echo 1. insert normal date data
INSERT INTO date_table VALUES (1,'2020-01-21');
INSERT INTO date_table VALUES (2,'2020-10-21');
INSERT INTO date_table VALUES (3,'2020-1-01');
INSERT INTO date_table VALUES (4,'2020-01-1');
INSERT INTO date_table VALUES (5,'2019-12-21');
INSERT INTO date_table VALUES (6,'2016-2-29');
INSERT INTO date_table VALUES (7,'1970-1-1');
INSERT INTO date_table VALUES (8,'2000-01-01');
INSERT INTO date_table VALUES (9,'2038-1-19');
-- echo 2. compare date data
-- sort SELECT * FROM date_table WHERE u_date>'2020-1-20';
-- sort SELECT * FROM date_table WHERE u_date<'2019-12-31';
-- sort SELECT * FROM date_table WHERE u_date='2020-1-1';
-- echo 3. delete data
DELETE FROM date_table WHERE u_date>'2012-2-29';
-- sort SELECT * FROM date_table;
-- echo 4. check invalid date data
SELECT * FROM date_table WHERE u_date='2017-2-29';
SELECT * FROM date_table WHERE u_date='2017-21-29';
SELECT * FROM date_table WHERE u_date='2017-12-32';
SELECT * FROM date_table WHERE u_date='2017-11-31';
INSERT INTO date_table VALUES (10,'2017-2-29');
INSERT INTO date_table VALUES (11,'2017-21-29');
INSERT INTO date_table VALUES (12,'2017-12-32');
INSERT INTO date_table VALUES (13,'2017-11-31');
-- echo 1. Drop empty table
CREATE TABLE Drop_table_1(id int, t_name char);
DROP TABLE Drop_table_1;
-- echo 2. Drop non-empty table
CREATE TABLE Drop_table_2(id int, t_name char);
INSERT INTO Drop_table_2 VALUES (1,'OB');
DROP TABLE Drop_table_2;
-- echo 3. Check the accuracy of dropping table
CREATE TABLE Drop_table_3(id int, t_name char);
INSERT INTO Drop_table_3 VALUES (1,'OB');
-- sort SELECT * FROM Drop_table_3;
DROP TABLE Drop_table_3;
INSERT INTO Drop_table_3 VALUES (1,'OB');
SELECT * FROM Drop_table_3;
DELETE FROM Drop_table_3 WHERE id = 3;
CREATE TABLE Drop_table_3(id int, t_name char);
-- sort SELECT * FROM Drop_table_3;
-- echo 4. Drop non-existent table
CREATE TABLE Drop_table_4(id int, t_name char);
DROP TABLE Drop_table_4;
DROP TABLE Drop_table_4;
DROP TABLE Drop_table_4_1;
-- echo 5. Create a table which has dropped
CREATE TABLE Drop_table_5(id int, t_name char);
DROP TABLE Drop_table_5;
CREATE TABLE Drop_table_5(id int, t_name char);
SELECT * FROM Drop_table_5;
-- echo 6. Drop a table with index
CREATE TABLE Drop_table_6(id int, t_name char);
CREATE INDEX index_id on Drop_table_6(id);
INSERT INTO Drop_table_6 VALUES (1,'OB');
-- sort SELECT * FROM Drop_table_6;
DROP TABLE Drop_table_6;
SELECT * FROM Drop_table_6;
-- echo initialization
create table exp_table(id int, col1 int, col2 int, col3 float, col4 float);
insert into exp_table VALUES (1, 1, 1, 1.0, 1.5);
insert into exp_table VALUES (2, 2, -2, 5.5, 1.0);
insert into exp_table VALUES (3, 3, 4, 5.0, 4.0);
-- echo 1. select
-- sort select * from exp_table where 1 = 5/4;
-- sort select * from exp_table where col1-2 > 0;
-- sort select * from exp_table where 2+col2 < 1;
-- sort select * from exp_table where col1*col2 < 0;
-- sort select * from exp_table where 5/4 = 1;
-- sort select * from exp_table where 0 < col1-2;
-- sort select * from exp_table where 1.0 > 2+col2;
-- sort select * from exp_table where -0 < col1-col2;
-- sort select * from exp_table where 0 < -2+col1;
-- sort select * from exp_table where 1+1 = 2*1.0;
-- sort select * from exp_table where 5/4*8 < 4+col2*col3/2;
-- sort select * from exp_table where 5/4*8 < (4+col2)*col3/2;
-- sort select id,-(col2*(-1)+1)+(col4+2)*(col1+col3*2),(4+col2)*col3/2 from exp_table where -(col2*(-1)+1)+(col4+2)*(col1+col3*2) > (4+col2)*col3/2;
-- sort select id,col1,col2,col3,col4,6-(col2*(1+col1))+(col4+2)/(1+col1*4+col3*2) from exp_table where 6-(col2*(1+col1))+(col4+2)/(1+col1*4+col3*2) > 5;
-- sort select id,col1,col2,col3,col4,3*col1/(col2+2) from exp_table where 3*col1/(col2+2) > 1;
-- sort select id,3*col1/(col2+2) from exp_table where 3*col1/(col2+2)+1/0 > 1;
-- sort select * from exp_table where 1/0 = 1/0;
-- echo 2. expression about many tables
create table exp_table2(id int, col1 int);
insert into exp_table2 VALUES (1, 1);
insert into exp_table2 VALUES (2, 3);
-- sort select exp_table.id,3*exp_table2.col1/(exp_table.col2+2) from exp_table,exp_table2 where 3*exp_table2.col1/(exp_table.col2+2)>1;
\ No newline at end of file
-- echo 1. create table
create table t_group_by (id int, score float, name char);
create table t_group_by_2 (id int, age int);
-- echo 2. insert records
insert into t_group_by values(3, 1.0, 'a');
insert into t_group_by values(1, 2.0, 'b');
insert into t_group_by values(4, 3.0, 'c');
insert into t_group_by values(3, 2.0, 'c');
insert into t_group_by values(3, 4.0, 'c');
insert into t_group_by values(3, 3.0, 'd');
insert into t_group_by values(3, 2.0, 'f');
insert into t_group_by_2 values(1, 10);
insert into t_group_by_2 values(2, 20);
insert into t_group_by_2 values(3, 10);
insert into t_group_by_2 values(3, 20);
insert into t_group_by_2 values(3, 40);
insert into t_group_by_2 values(4, 20);
-- echo 3. primary group by
-- sort select id, avg(score) from t_group_by group by id;
-- sort select name, min(id), max(score) from t_group_by group by name;
-- sort select id, name, avg(score) from t_group_by group by id, name;
-- echo 4. with where condition
-- sort select id, avg(score) from t_group_by where id>2 group by id;
-- sort select name, count(id), max(score) from t_group_by where name > 'a' and id>=0 group by name;
-- echo 5. multi table
-- sort select t_group_by.id, t_group_by.name, avg(t_group_by.score), avg(t_group_by_2.age) from t_group_by, t_group_by_2 where t_group_by.id=t_group_by_2.id group by t_group_by.id, t_group_by.name;
\ No newline at end of file
-- echo initialization
CREATE TABLE insert_table(id int, t_name char, col1 int, col2 int);
-- echo 1. insert
INSERT INTO insert_table VALUES (1,'N1',1,1);
INSERT INTO insert_table VALUES (2,'N2',1,1),(3,'N3',2,1);
-- echo 2. error
INSERT INTO insert_table VALUES (4,'N4',1,1),(1,1,1);
INSERT INTO insert_table VALUES (4,'N4',1,1),(1,1,1,1);
-- echo 3. select
-- sort SELECT * FROM insert_table;
\ No newline at end of file
-- echo initialization
CREATE TABLE join_table_1(id int, name char);
CREATE TABLE join_table_2(id int, num int);
CREATE TABLE join_table_3(id int, num2 int);
create table join_table_empty_1(id int, num_empty_1 int);
create table join_table_empty_2(id int, num_empty_2 int);
INSERT INTO join_table_1 VALUES (1, 'a');
INSERT INTO join_table_1 VALUES (2, 'b');
INSERT INTO join_table_1 VALUES (3, 'c');
INSERT INTO join_table_2 VALUES (1, 2);
INSERT INTO join_table_2 VALUES (2, 15);
INSERT INTO join_table_3 VALUES (1, 120);
INSERT INTO join_table_3 VALUES (3, 800);
-- echo 1. Select
-- sort Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id;
-- sort Select join_table_1.name from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id;
-- sort Select join_table_2.num from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id;
-- sort Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id inner join join_table_3 on join_table_1.id=join_table_3.id;
-- sort Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id and join_table_2.num>13 where join_table_1.name='b';
-- sort Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id and join_table_2.num>13 where join_table_1.name='a';
-- sort Select * from join_table_1 inner join join_table_2 on join_table_1.id=join_table_2.id and join_table_2.num>23 where join_table_1.name='b';
-- echo 3. empty
select * from join_table_1 inner join join_table_empty_1 on join_table_1.id=join_table_empty_1.id;
select * from join_table_empty_1 inner join join_table_1 on join_table_empty_1.id=join_table_1.id;
select * from join_table_empty_1 inner join join_table_empty_2 on join_table_empty_1.id = join_table_empty_2.id;
select * from join_table_1 inner join join_table_2 on join_table_1.id = join_table_2.id inner join join_table_empty_1 on join_table_1.id=join_table_empty_1.id;
select * from join_table_empty_1 inner join join_table_1 on join_table_empty_1.id=join_table_1.id inner join join_table_2 on join_table_1.id=join_table_2.id;
-- echo 4. very large join
create table join_table_large_1(id int, num1 int);
create table join_table_large_2(id int, num2 int);
create table join_table_large_3(id int, num3 int);
create table join_table_large_4(id int, num4 int);
create table join_table_large_5(id int, num5 int);
create table join_table_large_6(id int, num6 int);
insert into join_table_large_1 values(1, 1);
insert into join_table_large_1 values(2, 2);
insert into join_table_large_1 values(3, 3);
insert into join_table_large_1 values(4, 4);
insert into join_table_large_1 values(5, 5);
insert into join_table_large_1 values(6, 6);
insert into join_table_large_1 values(7, 7);
insert into join_table_large_1 values(8, 8);
insert into join_table_large_1 values(9, 9);
insert into join_table_large_1 values(10, 10);
insert into join_table_large_1 values(11, 11);
insert into join_table_large_1 values(12, 12);
insert into join_table_large_1 values(13, 13);
insert into join_table_large_1 values(14, 14);
insert into join_table_large_1 values(15, 15);
insert into join_table_large_1 values(16, 16);
insert into join_table_large_1 values(17, 17);
insert into join_table_large_1 values(18, 18);
insert into join_table_large_1 values(19, 19);
insert into join_table_large_1 values(20, 20);
insert into join_table_large_1 values(21, 21);
insert into join_table_large_1 values(22, 22);
insert into join_table_large_1 values(23, 23);
insert into join_table_large_1 values(24, 24);
insert into join_table_large_1 values(25, 25);
insert into join_table_large_1 values(26, 26);
insert into join_table_large_1 values(27, 27);
insert into join_table_large_1 values(28, 28);
insert into join_table_large_1 values(29, 29);
insert into join_table_large_1 values(30, 30);
insert into join_table_large_1 values(31, 31);
insert into join_table_large_1 values(32, 32);
insert into join_table_large_1 values(33, 33);
insert into join_table_large_1 values(34, 34);
insert into join_table_large_1 values(35, 35);
insert into join_table_large_1 values(36, 36);
insert into join_table_large_1 values(37, 37);
insert into join_table_large_1 values(38, 38);
insert into join_table_large_1 values(39, 39);
insert into join_table_large_1 values(40, 40);
insert into join_table_large_1 values(41, 41);
insert into join_table_large_1 values(42, 42);
insert into join_table_large_1 values(43, 43);
insert into join_table_large_1 values(44, 44);
insert into join_table_large_1 values(45, 45);
insert into join_table_large_1 values(46, 46);
insert into join_table_large_1 values(47, 47);
insert into join_table_large_1 values(48, 48);
insert into join_table_large_1 values(49, 49);
insert into join_table_large_1 values(50, 50);
insert into join_table_large_1 values(51, 51);
insert into join_table_large_1 values(52, 52);
insert into join_table_large_1 values(53, 53);
insert into join_table_large_1 values(54, 54);
insert into join_table_large_1 values(55, 55);
insert into join_table_large_1 values(56, 56);
insert into join_table_large_1 values(57, 57);
insert into join_table_large_1 values(58, 58);
insert into join_table_large_1 values(59, 59);
insert into join_table_large_1 values(60, 60);
insert into join_table_large_1 values(61, 61);
insert into join_table_large_1 values(62, 62);
insert into join_table_large_1 values(63, 63);
insert into join_table_large_1 values(64, 64);
insert into join_table_large_1 values(65, 65);
insert into join_table_large_1 values(66, 66);
insert into join_table_large_1 values(67, 67);
insert into join_table_large_1 values(68, 68);
insert into join_table_large_1 values(69, 69);
insert into join_table_large_1 values(70, 70);
insert into join_table_large_1 values(71, 71);
insert into join_table_large_1 values(72, 72);
insert into join_table_large_1 values(73, 73);
insert into join_table_large_1 values(74, 74);
insert into join_table_large_1 values(75, 75);
insert into join_table_large_1 values(76, 76);
insert into join_table_large_1 values(77, 77);
insert into join_table_large_1 values(78, 78);
insert into join_table_large_1 values(79, 79);
insert into join_table_large_1 values(80, 80);
insert into join_table_large_1 values(81, 81);
insert into join_table_large_1 values(82, 82);
insert into join_table_large_1 values(83, 83);
insert into join_table_large_1 values(84, 84);
insert into join_table_large_1 values(85, 85);
insert into join_table_large_1 values(86, 86);
insert into join_table_large_1 values(87, 87);
insert into join_table_large_1 values(88, 88);
insert into join_table_large_1 values(89, 89);
insert into join_table_large_1 values(90, 90);
insert into join_table_large_1 values(91, 91);
insert into join_table_large_1 values(92, 92);
insert into join_table_large_1 values(93, 93);
insert into join_table_large_1 values(94, 94);
insert into join_table_large_1 values(95, 95);
insert into join_table_large_1 values(96, 96);
insert into join_table_large_1 values(97, 97);
insert into join_table_large_1 values(98, 98);
insert into join_table_large_1 values(99, 99);
insert into join_table_large_1 values(100, 100);
insert into join_table_large_2 values(1, 1);
insert into join_table_large_2 values(2, 2);
insert into join_table_large_2 values(3, 3);
insert into join_table_large_2 values(4, 4);
insert into join_table_large_2 values(5, 5);
insert into join_table_large_2 values(6, 6);
insert into join_table_large_2 values(7, 7);
insert into join_table_large_2 values(8, 8);
insert into join_table_large_2 values(9, 9);
insert into join_table_large_2 values(10, 10);
insert into join_table_large_2 values(11, 11);
insert into join_table_large_2 values(12, 12);
insert into join_table_large_2 values(13, 13);
insert into join_table_large_2 values(14, 14);
insert into join_table_large_2 values(15, 15);
insert into join_table_large_2 values(16, 16);
insert into join_table_large_2 values(17, 17);
insert into join_table_large_2 values(18, 18);
insert into join_table_large_2 values(19, 19);
insert into join_table_large_2 values(20, 20);
insert into join_table_large_2 values(21, 21);
insert into join_table_large_2 values(22, 22);
insert into join_table_large_2 values(23, 23);
insert into join_table_large_2 values(24, 24);
insert into join_table_large_2 values(25, 25);
insert into join_table_large_2 values(26, 26);
insert into join_table_large_2 values(27, 27);
insert into join_table_large_2 values(28, 28);
insert into join_table_large_2 values(29, 29);
insert into join_table_large_2 values(30, 30);
insert into join_table_large_2 values(31, 31);
insert into join_table_large_2 values(32, 32);
insert into join_table_large_2 values(33, 33);
insert into join_table_large_2 values(34, 34);
insert into join_table_large_2 values(35, 35);
insert into join_table_large_2 values(36, 36);
insert into join_table_large_2 values(37, 37);
insert into join_table_large_2 values(38, 38);
insert into join_table_large_2 values(39, 39);
insert into join_table_large_2 values(40, 40);
insert into join_table_large_2 values(41, 41);
insert into join_table_large_2 values(42, 42);
insert into join_table_large_2 values(43, 43);
insert into join_table_large_2 values(44, 44);
insert into join_table_large_2 values(45, 45);
insert into join_table_large_2 values(46, 46);
insert into join_table_large_2 values(47, 47);
insert into join_table_large_2 values(48, 48);
insert into join_table_large_2 values(49, 49);
insert into join_table_large_2 values(50, 50);
insert into join_table_large_2 values(51, 51);
insert into join_table_large_2 values(52, 52);
insert into join_table_large_2 values(53, 53);
insert into join_table_large_2 values(54, 54);
insert into join_table_large_2 values(55, 55);
insert into join_table_large_2 values(56, 56);
insert into join_table_large_2 values(57, 57);
insert into join_table_large_2 values(58, 58);
insert into join_table_large_2 values(59, 59);
insert into join_table_large_2 values(60, 60);
insert into join_table_large_2 values(61, 61);
insert into join_table_large_2 values(62, 62);
insert into join_table_large_2 values(63, 63);
insert into join_table_large_2 values(64, 64);
insert into join_table_large_2 values(65, 65);
insert into join_table_large_2 values(66, 66);
insert into join_table_large_2 values(67, 67);
insert into join_table_large_2 values(68, 68);
insert into join_table_large_2 values(69, 69);
insert into join_table_large_2 values(70, 70);
insert into join_table_large_2 values(71, 71);
insert into join_table_large_2 values(72, 72);
insert into join_table_large_2 values(73, 73);
insert into join_table_large_2 values(74, 74);
insert into join_table_large_2 values(75, 75);
insert into join_table_large_2 values(76, 76);
insert into join_table_large_2 values(77, 77);
insert into join_table_large_2 values(78, 78);
insert into join_table_large_2 values(79, 79);
insert into join_table_large_2 values(80, 80);
insert into join_table_large_2 values(81, 81);
insert into join_table_large_2 values(82, 82);
insert into join_table_large_2 values(83, 83);
insert into join_table_large_2 values(84, 84);
insert into join_table_large_2 values(85, 85);
insert into join_table_large_2 values(86, 86);
insert into join_table_large_2 values(87, 87);
insert into join_table_large_2 values(88, 88);
insert into join_table_large_2 values(89, 89);
insert into join_table_large_2 values(90, 90);
insert into join_table_large_2 values(91, 91);
insert into join_table_large_2 values(92, 92);
insert into join_table_large_2 values(93, 93);
insert into join_table_large_2 values(94, 94);
insert into join_table_large_2 values(95, 95);
insert into join_table_large_2 values(96, 96);
insert into join_table_large_2 values(97, 97);
insert into join_table_large_2 values(98, 98);
insert into join_table_large_2 values(99, 99);
insert into join_table_large_2 values(100, 100);
insert into join_table_large_3 values(1, 1);
insert into join_table_large_3 values(2, 2);
insert into join_table_large_3 values(3, 3);
insert into join_table_large_3 values(4, 4);
insert into join_table_large_3 values(5, 5);
insert into join_table_large_3 values(6, 6);
insert into join_table_large_3 values(7, 7);
insert into join_table_large_3 values(8, 8);
insert into join_table_large_3 values(9, 9);
insert into join_table_large_3 values(10, 10);
insert into join_table_large_3 values(11, 11);
insert into join_table_large_3 values(12, 12);
insert into join_table_large_3 values(13, 13);
insert into join_table_large_3 values(14, 14);
insert into join_table_large_3 values(15, 15);
insert into join_table_large_3 values(16, 16);
insert into join_table_large_3 values(17, 17);
insert into join_table_large_3 values(18, 18);
insert into join_table_large_3 values(19, 19);
insert into join_table_large_3 values(20, 20);
insert into join_table_large_3 values(21, 21);
insert into join_table_large_3 values(22, 22);
insert into join_table_large_3 values(23, 23);
insert into join_table_large_3 values(24, 24);
insert into join_table_large_3 values(25, 25);
insert into join_table_large_3 values(26, 26);
insert into join_table_large_3 values(27, 27);
insert into join_table_large_3 values(28, 28);
insert into join_table_large_3 values(29, 29);
insert into join_table_large_3 values(30, 30);
insert into join_table_large_3 values(31, 31);
insert into join_table_large_3 values(32, 32);
insert into join_table_large_3 values(33, 33);
insert into join_table_large_3 values(34, 34);
insert into join_table_large_3 values(35, 35);
insert into join_table_large_3 values(36, 36);
insert into join_table_large_3 values(37, 37);
insert into join_table_large_3 values(38, 38);
insert into join_table_large_3 values(39, 39);
insert into join_table_large_3 values(40, 40);
insert into join_table_large_3 values(41, 41);
insert into join_table_large_3 values(42, 42);
insert into join_table_large_3 values(43, 43);
insert into join_table_large_3 values(44, 44);
insert into join_table_large_3 values(45, 45);
insert into join_table_large_3 values(46, 46);
insert into join_table_large_3 values(47, 47);
insert into join_table_large_3 values(48, 48);
insert into join_table_large_3 values(49, 49);
insert into join_table_large_3 values(50, 50);
insert into join_table_large_3 values(51, 51);
insert into join_table_large_3 values(52, 52);
insert into join_table_large_3 values(53, 53);
insert into join_table_large_3 values(54, 54);
insert into join_table_large_3 values(55, 55);
insert into join_table_large_3 values(56, 56);
insert into join_table_large_3 values(57, 57);
insert into join_table_large_3 values(58, 58);
insert into join_table_large_3 values(59, 59);
insert into join_table_large_3 values(60, 60);
insert into join_table_large_3 values(61, 61);
insert into join_table_large_3 values(62, 62);
insert into join_table_large_3 values(63, 63);
insert into join_table_large_3 values(64, 64);
insert into join_table_large_3 values(65, 65);
insert into join_table_large_3 values(66, 66);
insert into join_table_large_3 values(67, 67);
insert into join_table_large_3 values(68, 68);
insert into join_table_large_3 values(69, 69);
insert into join_table_large_3 values(70, 70);
insert into join_table_large_3 values(71, 71);
insert into join_table_large_3 values(72, 72);
insert into join_table_large_3 values(73, 73);
insert into join_table_large_3 values(74, 74);
insert into join_table_large_3 values(75, 75);
insert into join_table_large_3 values(76, 76);
insert into join_table_large_3 values(77, 77);
insert into join_table_large_3 values(78, 78);
insert into join_table_large_3 values(79, 79);
insert into join_table_large_3 values(80, 80);
insert into join_table_large_3 values(81, 81);
insert into join_table_large_3 values(82, 82);
insert into join_table_large_3 values(83, 83);
insert into join_table_large_3 values(84, 84);
insert into join_table_large_3 values(85, 85);
insert into join_table_large_3 values(86, 86);
insert into join_table_large_3 values(87, 87);
insert into join_table_large_3 values(88, 88);
insert into join_table_large_3 values(89, 89);
insert into join_table_large_3 values(90, 90);
insert into join_table_large_3 values(91, 91);
insert into join_table_large_3 values(92, 92);
insert into join_table_large_3 values(93, 93);
insert into join_table_large_3 values(94, 94);
insert into join_table_large_3 values(95, 95);
insert into join_table_large_3 values(96, 96);
insert into join_table_large_3 values(97, 97);
insert into join_table_large_3 values(98, 98);
insert into join_table_large_3 values(99, 99);
insert into join_table_large_3 values(100, 100);
insert into join_table_large_4 values(1, 1);
insert into join_table_large_4 values(2, 2);
insert into join_table_large_4 values(3, 3);
insert into join_table_large_4 values(4, 4);
insert into join_table_large_4 values(5, 5);
insert into join_table_large_4 values(6, 6);
insert into join_table_large_4 values(7, 7);
insert into join_table_large_4 values(8, 8);
insert into join_table_large_4 values(9, 9);
insert into join_table_large_4 values(10, 10);
insert into join_table_large_4 values(11, 11);
insert into join_table_large_4 values(12, 12);
insert into join_table_large_4 values(13, 13);
insert into join_table_large_4 values(14, 14);
insert into join_table_large_4 values(15, 15);
insert into join_table_large_4 values(16, 16);
insert into join_table_large_4 values(17, 17);
insert into join_table_large_4 values(18, 18);
insert into join_table_large_4 values(19, 19);
insert into join_table_large_4 values(20, 20);
insert into join_table_large_4 values(21, 21);
insert into join_table_large_4 values(22, 22);
insert into join_table_large_4 values(23, 23);
insert into join_table_large_4 values(24, 24);
insert into join_table_large_4 values(25, 25);
insert into join_table_large_4 values(26, 26);
insert into join_table_large_4 values(27, 27);
insert into join_table_large_4 values(28, 28);
insert into join_table_large_4 values(29, 29);
insert into join_table_large_4 values(30, 30);
insert into join_table_large_4 values(31, 31);
insert into join_table_large_4 values(32, 32);
insert into join_table_large_4 values(33, 33);
insert into join_table_large_4 values(34, 34);
insert into join_table_large_4 values(35, 35);
insert into join_table_large_4 values(36, 36);
insert into join_table_large_4 values(37, 37);
insert into join_table_large_4 values(38, 38);
insert into join_table_large_4 values(39, 39);
insert into join_table_large_4 values(40, 40);
insert into join_table_large_4 values(41, 41);
insert into join_table_large_4 values(42, 42);
insert into join_table_large_4 values(43, 43);
insert into join_table_large_4 values(44, 44);
insert into join_table_large_4 values(45, 45);
insert into join_table_large_4 values(46, 46);
insert into join_table_large_4 values(47, 47);
insert into join_table_large_4 values(48, 48);
insert into join_table_large_4 values(49, 49);
insert into join_table_large_4 values(50, 50);
insert into join_table_large_4 values(51, 51);
insert into join_table_large_4 values(52, 52);
insert into join_table_large_4 values(53, 53);
insert into join_table_large_4 values(54, 54);
insert into join_table_large_4 values(55, 55);
insert into join_table_large_4 values(56, 56);
insert into join_table_large_4 values(57, 57);
insert into join_table_large_4 values(58, 58);
insert into join_table_large_4 values(59, 59);
insert into join_table_large_4 values(60, 60);
insert into join_table_large_4 values(61, 61);
insert into join_table_large_4 values(62, 62);
insert into join_table_large_4 values(63, 63);
insert into join_table_large_4 values(64, 64);
insert into join_table_large_4 values(65, 65);
insert into join_table_large_4 values(66, 66);
insert into join_table_large_4 values(67, 67);
insert into join_table_large_4 values(68, 68);
insert into join_table_large_4 values(69, 69);
insert into join_table_large_4 values(70, 70);
insert into join_table_large_4 values(71, 71);
insert into join_table_large_4 values(72, 72);
insert into join_table_large_4 values(73, 73);
insert into join_table_large_4 values(74, 74);
insert into join_table_large_4 values(75, 75);
insert into join_table_large_4 values(76, 76);
insert into join_table_large_4 values(77, 77);
insert into join_table_large_4 values(78, 78);
insert into join_table_large_4 values(79, 79);
insert into join_table_large_4 values(80, 80);
insert into join_table_large_4 values(81, 81);
insert into join_table_large_4 values(82, 82);
insert into join_table_large_4 values(83, 83);
insert into join_table_large_4 values(84, 84);
insert into join_table_large_4 values(85, 85);
insert into join_table_large_4 values(86, 86);
insert into join_table_large_4 values(87, 87);
insert into join_table_large_4 values(88, 88);
insert into join_table_large_4 values(89, 89);
insert into join_table_large_4 values(90, 90);
insert into join_table_large_4 values(91, 91);
insert into join_table_large_4 values(92, 92);
insert into join_table_large_4 values(93, 93);
insert into join_table_large_4 values(94, 94);
insert into join_table_large_4 values(95, 95);
insert into join_table_large_4 values(96, 96);
insert into join_table_large_4 values(97, 97);
insert into join_table_large_4 values(98, 98);
insert into join_table_large_4 values(99, 99);
insert into join_table_large_4 values(100, 100);
insert into join_table_large_5 values(1, 1);
insert into join_table_large_5 values(2, 2);
insert into join_table_large_5 values(3, 3);
insert into join_table_large_5 values(4, 4);
insert into join_table_large_5 values(5, 5);
insert into join_table_large_5 values(6, 6);
insert into join_table_large_5 values(7, 7);
insert into join_table_large_5 values(8, 8);
insert into join_table_large_5 values(9, 9);
insert into join_table_large_5 values(10, 10);
insert into join_table_large_5 values(11, 11);
insert into join_table_large_5 values(12, 12);
insert into join_table_large_5 values(13, 13);
insert into join_table_large_5 values(14, 14);
insert into join_table_large_5 values(15, 15);
insert into join_table_large_5 values(16, 16);
insert into join_table_large_5 values(17, 17);
insert into join_table_large_5 values(18, 18);
insert into join_table_large_5 values(19, 19);
insert into join_table_large_5 values(20, 20);
insert into join_table_large_5 values(21, 21);
insert into join_table_large_5 values(22, 22);
insert into join_table_large_5 values(23, 23);
insert into join_table_large_5 values(24, 24);
insert into join_table_large_5 values(25, 25);
insert into join_table_large_5 values(26, 26);
insert into join_table_large_5 values(27, 27);
insert into join_table_large_5 values(28, 28);
insert into join_table_large_5 values(29, 29);
insert into join_table_large_5 values(30, 30);
insert into join_table_large_5 values(31, 31);
insert into join_table_large_5 values(32, 32);
insert into join_table_large_5 values(33, 33);
insert into join_table_large_5 values(34, 34);
insert into join_table_large_5 values(35, 35);
insert into join_table_large_5 values(36, 36);
insert into join_table_large_5 values(37, 37);
insert into join_table_large_5 values(38, 38);
insert into join_table_large_5 values(39, 39);
insert into join_table_large_5 values(40, 40);
insert into join_table_large_5 values(41, 41);
insert into join_table_large_5 values(42, 42);
insert into join_table_large_5 values(43, 43);
insert into join_table_large_5 values(44, 44);
insert into join_table_large_5 values(45, 45);
insert into join_table_large_5 values(46, 46);
insert into join_table_large_5 values(47, 47);
insert into join_table_large_5 values(48, 48);
insert into join_table_large_5 values(49, 49);
insert into join_table_large_5 values(50, 50);
insert into join_table_large_5 values(51, 51);
insert into join_table_large_5 values(52, 52);
insert into join_table_large_5 values(53, 53);
insert into join_table_large_5 values(54, 54);
insert into join_table_large_5 values(55, 55);
insert into join_table_large_5 values(56, 56);
insert into join_table_large_5 values(57, 57);
insert into join_table_large_5 values(58, 58);
insert into join_table_large_5 values(59, 59);
insert into join_table_large_5 values(60, 60);
insert into join_table_large_5 values(61, 61);
insert into join_table_large_5 values(62, 62);
insert into join_table_large_5 values(63, 63);
insert into join_table_large_5 values(64, 64);
insert into join_table_large_5 values(65, 65);
insert into join_table_large_5 values(66, 66);
insert into join_table_large_5 values(67, 67);
insert into join_table_large_5 values(68, 68);
insert into join_table_large_5 values(69, 69);
insert into join_table_large_5 values(70, 70);
insert into join_table_large_5 values(71, 71);
insert into join_table_large_5 values(72, 72);
insert into join_table_large_5 values(73, 73);
insert into join_table_large_5 values(74, 74);
insert into join_table_large_5 values(75, 75);
insert into join_table_large_5 values(76, 76);
insert into join_table_large_5 values(77, 77);
insert into join_table_large_5 values(78, 78);
insert into join_table_large_5 values(79, 79);
insert into join_table_large_5 values(80, 80);
insert into join_table_large_5 values(81, 81);
insert into join_table_large_5 values(82, 82);
insert into join_table_large_5 values(83, 83);
insert into join_table_large_5 values(84, 84);
insert into join_table_large_5 values(85, 85);
insert into join_table_large_5 values(86, 86);
insert into join_table_large_5 values(87, 87);
insert into join_table_large_5 values(88, 88);
insert into join_table_large_5 values(89, 89);
insert into join_table_large_5 values(90, 90);
insert into join_table_large_5 values(91, 91);
insert into join_table_large_5 values(92, 92);
insert into join_table_large_5 values(93, 93);
insert into join_table_large_5 values(94, 94);
insert into join_table_large_5 values(95, 95);
insert into join_table_large_5 values(96, 96);
insert into join_table_large_5 values(97, 97);
insert into join_table_large_5 values(98, 98);
insert into join_table_large_5 values(99, 99);
insert into join_table_large_5 values(100, 100);
insert into join_table_large_6 values(1, 1);
insert into join_table_large_6 values(2, 2);
insert into join_table_large_6 values(3, 3);
insert into join_table_large_6 values(4, 4);
insert into join_table_large_6 values(5, 5);
insert into join_table_large_6 values(6, 6);
insert into join_table_large_6 values(7, 7);
insert into join_table_large_6 values(8, 8);
insert into join_table_large_6 values(9, 9);
insert into join_table_large_6 values(10, 10);
insert into join_table_large_6 values(11, 11);
insert into join_table_large_6 values(12, 12);
insert into join_table_large_6 values(13, 13);
insert into join_table_large_6 values(14, 14);
insert into join_table_large_6 values(15, 15);
insert into join_table_large_6 values(16, 16);
insert into join_table_large_6 values(17, 17);
insert into join_table_large_6 values(18, 18);
insert into join_table_large_6 values(19, 19);
insert into join_table_large_6 values(20, 20);
insert into join_table_large_6 values(21, 21);
insert into join_table_large_6 values(22, 22);
insert into join_table_large_6 values(23, 23);
insert into join_table_large_6 values(24, 24);
insert into join_table_large_6 values(25, 25);
insert into join_table_large_6 values(26, 26);
insert into join_table_large_6 values(27, 27);
insert into join_table_large_6 values(28, 28);
insert into join_table_large_6 values(29, 29);
insert into join_table_large_6 values(30, 30);
insert into join_table_large_6 values(31, 31);
insert into join_table_large_6 values(32, 32);
insert into join_table_large_6 values(33, 33);
insert into join_table_large_6 values(34, 34);
insert into join_table_large_6 values(35, 35);
insert into join_table_large_6 values(36, 36);
insert into join_table_large_6 values(37, 37);
insert into join_table_large_6 values(38, 38);
insert into join_table_large_6 values(39, 39);
insert into join_table_large_6 values(40, 40);
insert into join_table_large_6 values(41, 41);
insert into join_table_large_6 values(42, 42);
insert into join_table_large_6 values(43, 43);
insert into join_table_large_6 values(44, 44);
insert into join_table_large_6 values(45, 45);
insert into join_table_large_6 values(46, 46);
insert into join_table_large_6 values(47, 47);
insert into join_table_large_6 values(48, 48);
insert into join_table_large_6 values(49, 49);
insert into join_table_large_6 values(50, 50);
insert into join_table_large_6 values(51, 51);
insert into join_table_large_6 values(52, 52);
insert into join_table_large_6 values(53, 53);
insert into join_table_large_6 values(54, 54);
insert into join_table_large_6 values(55, 55);
insert into join_table_large_6 values(56, 56);
insert into join_table_large_6 values(57, 57);
insert into join_table_large_6 values(58, 58);
insert into join_table_large_6 values(59, 59);
insert into join_table_large_6 values(60, 60);
insert into join_table_large_6 values(61, 61);
insert into join_table_large_6 values(62, 62);
insert into join_table_large_6 values(63, 63);
insert into join_table_large_6 values(64, 64);
insert into join_table_large_6 values(65, 65);
insert into join_table_large_6 values(66, 66);
insert into join_table_large_6 values(67, 67);
insert into join_table_large_6 values(68, 68);
insert into join_table_large_6 values(69, 69);
insert into join_table_large_6 values(70, 70);
insert into join_table_large_6 values(71, 71);
insert into join_table_large_6 values(72, 72);
insert into join_table_large_6 values(73, 73);
insert into join_table_large_6 values(74, 74);
insert into join_table_large_6 values(75, 75);
insert into join_table_large_6 values(76, 76);
insert into join_table_large_6 values(77, 77);
insert into join_table_large_6 values(78, 78);
insert into join_table_large_6 values(79, 79);
insert into join_table_large_6 values(80, 80);
insert into join_table_large_6 values(81, 81);
insert into join_table_large_6 values(82, 82);
insert into join_table_large_6 values(83, 83);
insert into join_table_large_6 values(84, 84);
insert into join_table_large_6 values(85, 85);
insert into join_table_large_6 values(86, 86);
insert into join_table_large_6 values(87, 87);
insert into join_table_large_6 values(88, 88);
insert into join_table_large_6 values(89, 89);
insert into join_table_large_6 values(90, 90);
insert into join_table_large_6 values(91, 91);
insert into join_table_large_6 values(92, 92);
insert into join_table_large_6 values(93, 93);
insert into join_table_large_6 values(94, 94);
insert into join_table_large_6 values(95, 95);
insert into join_table_large_6 values(96, 96);
insert into join_table_large_6 values(97, 97);
insert into join_table_large_6 values(98, 98);
insert into join_table_large_6 values(99, 99);
insert into join_table_large_6 values(100, 100);
-- sort select * from join_table_large_1 inner join join_table_large_2 on join_table_large_1.id=join_table_large_2.id inner join join_table_large_3 on join_table_large_1.id=join_table_large_3.id inner join join_table_large_4 on join_table_large_3.id=join_table_large_4.id inner join join_table_large_5 on 1=1 inner join join_table_large_6 on join_table_large_5.id=join_table_large_6.id where join_table_large_3.num3 <10 and join_table_large_5.num5>90;
-- echo 1. multi index of empty table
CREATE TABLE multi_index(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
CREATE INDEX i_1_12 ON multi_index(col1,col2);
CREATE INDEX i_1_345 ON multi_index(col3, col4, col5);
CREATE INDEX i_1_56 ON multi_index(col5, col6);
CREATE INDEX i_1_456 ON multi_index(col4, col5, col6);
-- sort SELECT * FROM multi_index;
-- echo 2. multi index of non-empty table
CREATE TABLE multi_index2(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
INSERT INTO multi_index2 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
INSERT INTO multi_index2 VALUES (2, 1, 16.2, 'x', '2021-01-02', 1, 61);
INSERT INTO multi_index2 VALUES (3, 1, 11.6, 'h', '2023-01-02', 10, 17);
CREATE INDEX i_2_12 ON multi_index2(col1,col2);
CREATE INDEX i_2_345 ON multi_index2(col3, col4, col5);
CREATE INDEX i_2_56 ON multi_index2(col5, col6);
CREATE INDEX i_2_456 ON multi_index2(col4, col5, col6);
-- sort SELECT * FROM multi_index2;
-- echo 3. influence of inserting
CREATE TABLE multi_index3(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
CREATE INDEX i_3_i1 ON multi_index3(id,col1);
INSERT INTO multi_index3 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
INSERT INTO multi_index3 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
-- sort SELECT * FROM multi_index3;
CREATE INDEX i_3_14 ON multi_index3(col1,col4);
INSERT INTO multi_index3 VALUES (2, 1, 16.2, 'x', '2021-01-02', 1, 61);
INSERT INTO multi_index3 VALUES (3, 1, 11.6, 'h', '2023-01-02', 10, 17);
INSERT INTO multi_index3 VALUES (4, 2, 12.2, 'e', '2022-01-04', 13, 10);
INSERT INTO multi_index3 VALUES (5, 3, 14.2, 'd', '2020-04-02', 12, 2);
-- sort SELECT * FROM multi_index3;
-- echo 4. query with indexs
-- sort SELECT * FROM multi_index3 WHERE id = 1;
-- sort SELECT * FROM multi_index3 WHERE col1 > 1 and col4 = '2021-01-02';
-- sort SELECT * FROM multi_index3 WHERE col1 <> 1 and col4 >= '2021-01-02';
-- sort SELECT * FROM multi_index3 WHERE col2 < 15.0 and col4 <> '2021-01-02';
-- echo 5. influence of deleting
DELETE FROM multi_index3 WHERE id = 1;
DELETE FROM multi_index3 WHERE id = 61;
-- sort SELECT * FROM multi_index3;
DELETE FROM multi_index3 WHERE col3 = 'x';
-- sort SELECT * FROM multi_index3;
DELETE FROM multi_index3 WHERE id = 4 and col1 = 1;
DELETE FROM multi_index3 WHERE id = 90 and col1 = 13;
DELETE FROM multi_index3 WHERE id = 90 and col1 = 1;
DELETE FROM multi_index3 WHERE id = 4 and col1 = 13;
DELETE FROM multi_index3 WHERE id = 3 and col1 = 1;
DELETE FROM multi_index3 WHERE id = 3 and col1 = 1;
-- sort SELECT * FROM multi_index3;
INSERT INTO multi_index3 VALUES (1, 1, 11.2, 'a', '2021-01-02', 1, 1);
INSERT INTO multi_index3 VALUES (2, 1, 11.2, 'x', '2021-01-02', 1, 61);
INSERT INTO multi_index3 VALUES (3, 1, 11.2, 'h', '2023-01-02', 10, 17);
-- sort SELECT * FROM multi_index3;
-- echo 6. influence of updating
UPDATE multi_index3 SET col6=49 where id=2;
UPDATE multi_index3 SET col4='1999-02-01' where id=2;
UPDATE multi_index3 SET col1=2 where id=2;
UPDATE multi_index3 SET col1=5 where col6=49;
-- sort SELECT * FROM multi_index3;
-- echo 7. influence of dropping table
DROP table multi_index;
-- echo 8. error
CREATE TABLE multi_index4(id int, col1 int, col2 float, col3 char, col4 date, col5 int, col6 int);
CREATE INDEX i_4_i7 ON multi_index4(id,col7);
CREATE INDEX i_4_78 ON multi_index4(col7,col8);
CREATE INDEX i_4_i78 ON multi_index4(id,col7,col8);
-- echo initialization
CREATE TABLE null_table(id int, num int nullable, price float not null, birthday date nullable);
CREATE TABLE null_table2(id int, num int nullable, price float not null, birthday date nullable);
CREATE INDEX index_num on null_table(num);
-- echo 1. insert
INSERT INTO null_table VALUES (1, 18, 10.0, '2020-01-01');
INSERT INTO null_table VALUES (2, null, 20.0, '2010-01-11');
INSERT INTO null_table VALUES (3, 12, 30.0, null);
INSERT INTO null_table VALUES (4, 15, 30.0, '2021-01-31');
INSERT INTO null_table2 VALUES (1, 18, 30.0, '2021-01-31');
INSERT INTO null_table2 VALUES (2, null, 40.0, null);
INSERT INTO null_table VALUES (5, 15, null, '2021-01-31');
INSERT INTO null_table VALUES (null, 15, 30.0, '2021-01-31');
-- echo 2. SELECT
-- sort SELECT * FROM null_table;
-- echo 3. SELECT WITH CONSTANT
-- sort SELECT * FROM null_table where 1 is null;
-- sort SELECT * FROM null_table where 1 is not null;
-- sort SELECT * FROM null_table where null=1;
-- sort SELECT * FROM null_table where 1=null;
-- sort SELECT * FROM null_table where 1<>null;
-- sort SELECT * FROM null_table where 1<null;
-- sort SELECT * FROM null_table where 1>null;
-- sort SELECT * FROM null_table where null is null;
-- sort SELECT * FROM null_table where null is not null;
-- sort SELECT * FROM null_table WHERE null=null;
-- sort SELECT * FROM null_table WHERE null<>null;
-- sort SELECT * FROM null_table WHERE null>null;
-- sort SELECT * FROM null_table WHERE null<null;
-- sort SELECT * FROM null_table where 'a' is null;
-- sort SELECT * FROM null_table where 'a' is not null;
-- sort SELECT * FROM null_table WHERE null='a';
-- sort SELECT * FROM null_table WHERE 'a'=null;
-- sort SELECT * FROM null_table WHERE 'a'<>null;
-- sort SELECT * FROM null_table WHERE 'a'>null;
-- sort SELECT * FROM null_table WHERE 'a'<null;
-- sort SELECT * FROM null_table where '2021-01-31' is null;
-- sort SELECT * FROM null_table where '2021-01-31' is not null;
-- sort SELECT * FROM null_table WHERE null='2021-01-31';
-- sort SELECT * FROM null_table WHERE '2021-01-31'=null;
-- sort SELECT * FROM null_table WHERE '2021-01-31'>null;
-- sort SELECT * FROM null_table WHERE '2021-01-31'<null;
-- echo 4. SELECT WITH COLUMN
-- sort SELECT * FROM null_table where birthday is not null;
-- sort SELECT * FROM null_table where birthday is null;
-- sort SELECT * FROM null_table where birthday = null;
-- sort SELECT * FROM null_table where null = birthday;
-- sort SELECT * FROM null_table where birthday <> null;
-- sort SELECT * FROM null_table where birthday > null;
-- sort SELECT * FROM null_table where birthday < null;
-- sort SELECT * FROM null_table where num is not null;
-- sort SELECT * FROM null_table where num is null;
-- sort SELECT * FROM null_table where num = null;
-- sort SELECT * FROM null_table where null = num;
-- sort SELECT * FROM null_table where num <> null;
-- sort SELECT * FROM null_table where num > null;
-- sort SELECT * FROM null_table where num < null;
-- sort SELECT null_table.num,null_table2.num,null_table.birthday FROM null_table,null_table2 where null_table.num=null_table2.num;
-- echo 5. aggregation
SELECT count(*) FROM null_table;
SELECT count(price) FROM null_table;
SELECT count(birthday) FROM null_table;
SELECT avg(num) FROM null_table;
-- echo 6. aggregation with null columns
CREATE TABLE null_table3(id int, num int nullable);
INSERT INTO null_table3 VALUES (1, null);
INSERT INTO null_table3 VALUES (2, null);
SELECT count(num) FROM null_table3;
SELECT min(num) FROM null_table3;
SELECT max(num) FROM null_table3;
SELECT avg(num) FROM null_table3;
-- echo 1. create table
create table t_order_by(id int, score float, name char);
create table t_order_by_2(id int, age int);
-- echo 2. insert records
insert into t_order_by values(3, 1.0, 'a');
insert into t_order_by values(1, 2.0, 'b');
insert into t_order_by values(4, 3.0, 'c');
insert into t_order_by values(3, 2.0, 'c');
insert into t_order_by values(3, 4.0, 'c');
insert into t_order_by values(3, 3.0, 'd');
insert into t_order_by values(3, 2.0, 'f');
insert into t_order_by_2 values(1, 10);
insert into t_order_by_2 values(2, 20);
insert into t_order_by_2 values(3, 10);
insert into t_order_by_2 values(3, 20);
insert into t_order_by_2 values(3, 40);
insert into t_order_by_2 values(4, 20);
-- echo 3. primary order by
-- sort select * from t_order_by order by id;
-- sort select * from t_order_by order by id asc;
-- sort select * from t_order_by order by id desc;
-- sort select * from t_order_by order by score desc;
-- sort select * from t_order_by order by name desc;
-- echo 4. order by more than one fields
select * from t_order_by order by id, score, name;
select * from t_order_by order by id desc, score asc, name desc;
-- echo 5. order by associate with where condition
select * from t_order_by where id=3 and name>='a' order by score desc, name;
-- echo 6. multi-table order by
select * from t_order_by,t_order_by_2 order by t_order_by.id,t_order_by.score,t_order_by.name,t_order_by_2.id,t_order_by_2.age;
select * from t_order_by, t_order_by_2 where t_order_by.id=t_order_by_2.id order by t_order_by.score desc, t_order_by_2.age asc, t_order_by.id asc, t_order_by.name;
-- echo initialization
CREATE TABLE Select_meta(id int, age int);
-- echo 1. select from a non-existent table
select * from no_table;
-- echo 2. select from a non-existent column
select home from Select_meta;
select * from Select_meta where home='001';
-- echo initialization
CREATE TABLE Select_tables_1(id int, age int, u_name char);
CREATE TABLE Select_tables_2(id int, age int, u_name char);
CREATE TABLE Select_tables_3(id int, res int, u_name char);
CREATE TABLE Select_tables_4(id int, age int, u_name char);
CREATE TABLE Select_tables_5(id int, res int, u_name char);
INSERT INTO Select_tables_1 VALUES (1,18,'a');
INSERT INTO Select_tables_1 VALUES (2,15,'b');
INSERT INTO Select_tables_2 VALUES (1,20,'a');
INSERT INTO Select_tables_2 VALUES (2,21,'c');
INSERT INTO Select_tables_3 VALUES (1,35,'a');
INSERT INTO Select_tables_3 VALUES (2,37,'a');
-- echo insert data into select_tables_4 and select_tables_5
INSERT INTO Select_tables_4 VALUES (1, 2, 'a');
INSERT INTO Select_tables_4 VALUES (1, 3, 'b');
INSERT INTO Select_tables_4 VALUES (2, 2, 'c');
INSERT INTO Select_tables_4 VALUES (2, 4, 'd');
INSERT INTO Select_tables_5 VALUES (1, 10, 'g');
INSERT INTO Select_tables_5 VALUES (1, 11, 'f');
INSERT INTO Select_tables_5 VALUES (2, 12, 'c');
-- echo 1. multi-table query
-- sort SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3;
-- sort SELECT Select_tables_1.id,Select_tables_2.u_name,Select_tables_3.res FROM Select_tables_1,Select_tables_2,Select_tables_3;
Select Select_tables_1.res FROM Select_tables_1,Select_tables_2,Select_tables_3;
-- echo 2. conditional query
-- sort SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3 WHERE Select_tables_1.u_name=Select_tables_2.u_name AND Select_tables_2.u_name=Select_tables_3.u_name;
-- sort SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3 WHERE Select_tables_1.id=Select_tables_2.id AND Select_tables_3.res=35;
-- sort SELECT * FROM Select_tables_1,Select_tables_2,Select_tables_3 WHERE Select_tables_1.age<18 AND Select_tables_2.u_name='c' AND Select_tables_3.res=35 AND Select_tables_1.id=Select_tables_2.id AND Select_tables_2.id=Select_tables_3.id;
-- sort SELECT Select_tables_2.age FROM Select_tables_1,Select_tables_2 WHERE Select_tables_1.age<18 AND Select_tables_2.u_name='c' AND Select_tables_1.id=Select_tables_2.id;
-- echo 3. duplicate key query
-- sort SELECT * from Select_tables_4, Select_tables_5 where Select_tables_4.id=Select_tables_5.id;
-- sort select * from Select_tables_4, Select_tables_5 where Select_tables_4.id >= Select_tables_5.id;
-- echo 4. join empty table
CREATE TABLE Select_tables_6(id int, res int);
-- sort SELECT Select_tables_1.id,Select_tables_6.id from Select_tables_1, Select_tables_6 where Select_tables_1.id=Select_tables_6.id;
-- echo initialization
CREATE TABLE ssq_1(id int, col1 int, feat1 float);
CREATE TABLE ssq_2(id int, col2 int, feat2 float);
CREATE TABLE ssq_3(id int, col3 int, feat3 float);
INSERT INTO ssq_1 VALUES (1, 4, 11.2);
INSERT INTO ssq_1 VALUES (2, 2, 12.0);
INSERT INTO ssq_1 VALUES (3, 3, 13.5);
INSERT INTO ssq_2 VALUES (1, 2, 13.0);
INSERT INTO ssq_2 VALUES (2, 7, 10.5);
INSERT INTO ssq_2 VALUES (5, 3, 12.6);
-- echo 1. Select
-- sort select * from ssq_1 where id in (select ssq_2.id from ssq_2);
-- sort select * from ssq_1 where col1 not in (select ssq_2.col2 from ssq_2);
-- sort select * from ssq_1 where col1 = (select avg(ssq_2.col2) from ssq_2);
-- sort select * from ssq_1 where (select avg(ssq_2.col2) from ssq_2) = col1;
-- sort select * from ssq_1 where feat1 >= (select min(ssq_2.feat2) from ssq_2);
-- sort select * from ssq_1 where (select min(ssq_2.feat2) from ssq_2) <= feat1;
-- sort select * from ssq_1 where feat1 <= (select max(ssq_2.feat2) from ssq_2);
-- sort select * from ssq_1 where (select max(ssq_2.feat2) from ssq_2) >= feat1;
-- sort select * from ssq_1 where feat1 > (select min(ssq_2.feat2) from ssq_2);
-- sort select * from ssq_1 where (select min(ssq_2.feat2) from ssq_2) < feat1;
-- sort select * from ssq_1 where feat1 < (select max(ssq_2.feat2) from ssq_2);
-- sort select * from ssq_1 where (select max(ssq_2.feat2) from ssq_2) > feat1;
-- sort select * from ssq_1 where feat1 <> (select avg(ssq_2.feat2) from ssq_2);
-- echo 2. Select with empty table
-- sort select * from ssq_1 where feat1 < (select max(ssq_2.feat2) from ssq_2 where 1=0);
-- sort select * from ssq_1 where id in (select ssq_2.id from ssq_2 where 1=0);
-- sort select * from ssq_1 where id not in (select ssq_2.id from ssq_2 where 1=0);
-- sort select * from ssq_3 where feat3 < (select max(ssq_2.feat2) from ssq_2);
-- sort select * from ssq_3 where id in (select ssq_2.id from ssq_2);
-- sort select * from ssq_3 where id not in (select ssq_2.id from ssq_2);
--echo 3. error
select * from ssq_1 where col1 = (select ssq_2.col2 from ssq_2);
select * from ssq_1 where col1 = (select * from ssq_2);
select * from ssq_1 where col1 in (select * from ssq_2);
select * from ssq_1 where col1 not in (select * from ssq_2);
\ No newline at end of file
-- echo initialization
create table text_table(id int, info text);
-- echo 1. insert
insert into text_table values (1,'this is a very very long string');
insert into text_table values (2,'this is a very very long string2');
insert into text_table values (3,'this is a very very long string3');
-- sort select * from text_table;
-- echo 2. condition
delete from text_table where id=1;
-- sort select * from text_table;
-- echo 3. update
UPDATE text_table set info='a tmp data' where id = 2;
-- sort select * from text_table;
-- echo 4. boundary test with length 4096
insert into text_table values (4,'this is a very very long string pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad1');
-- sort select * from text_table;
insert into text_table values (5,'this is a very very long string pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad pad1 pad pad pad pad');
-- sort select * from text_table;
-- echo initialization
CREATE TABLE unique_table(id int, col1 int, col2 int);
INSERT INTO unique_table VALUES (1,1,1);
-- echo 1. unique test
CREATE UNIQUE INDEX index_id on unique_table(id);
INSERT INTO unique_table VALUES (2,1,1);
CREATE UNIQUE INDEX index_id on unique_table(id);
INSERT INTO unique_table VALUES (3,2,1);
INSERT INTO unique_table VALUES (1,2,1);
-- echo 2. select
-- sort SELECT * FROM unique_table;
\ No newline at end of file
-- echo initialization
CREATE TABLE Update_table_1(id int, t_name char, col1 int, col2 int);
CREATE INDEX index_id on Update_table_1(id);
INSERT INTO Update_table_1 VALUES (1,'N1',1,1);
INSERT INTO Update_table_1 VALUES (2,'N2',1,1);
INSERT INTO Update_table_1 VALUES (3,'N3',2,1);
-- echo 1. update a row
UPDATE Update_table_1 SET t_name='N01' WHERE id=1;
-- sort SELECT * FROM Update_table_1;
-- echo 2. update rows
UPDATE Update_table_1 SET col2=0 WHERE col1=1;
-- sort SELECT * FROM Update_table_1;
-- echo 3. update a index column
UPDATE Update_table_1 SET id=4 WHERE t_name='N3';
-- sort SELECT * FROM Update_table_1;
-- echo 4. update without conditions
UPDATE Update_table_1 SET col1=0;
-- sort SELECT * FROM Update_table_1;
-- echo 5. update with conditions
UPDATE Update_table_1 SET t_name='N02' WHERE col1=0 AND col2=0;
-- sort SELECT * FROM Update_table_1;
-- echo 6. update non-existent table
UPDATE Update_table_2 SET t_name='N01' WHERE id=1;
-- echo 7. update non-existent column
UPDATE Update_table_1 SET t_name_false='N01' WHERE id=1;
-- echo 8. update with invalid condition
UPDATE Update_table_1 SET t_name='N01' WHERE id_false=1;
-- echo 9. update in vain
UPDATE Update_table_1 SET t_name='N01' WHERE id=100;
-- sort SELECT * FROM Update_table_1;
-- echo 10. update with invalid value
UPDATE Update_table_1 SET col1='N01' WHERE id=1;
\ No newline at end of file
...@@ -9,10 +9,10 @@ MESSAGE("${CMAKE_COMMON_FLAGS}") ...@@ -9,10 +9,10 @@ MESSAGE("${CMAKE_COMMON_FLAGS}")
#INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...) #INCLUDE_DIRECTORIES([AFTER|BEFORE] [SYSTEM] dir1 dir2 ...)
INCLUDE_DIRECTORIES(. ${PROJECT_SOURCE_DIR}/../deps /usr/local/include SYSTEM) INCLUDE_DIRECTORIES(. ${PROJECT_SOURCE_DIR}/../../deps /usr/local/include SYSTEM)
# 父cmake 设置的include_directories 和link_directories并不传导到子cmake里面 # 父cmake 设置的include_directories 和link_directories并不传导到子cmake里面
#INCLUDE_DIRECTORIES(BEFORE ${CMAKE_INSTALL_PREFIX}/include) #INCLUDE_DIRECTORIES(BEFORE ${CMAKE_INSTALL_PREFIX}/include)
LINK_DIRECTORIES(/usr/local/lib ${PROJECT_BINARY_DIR}/../lib) LINK_DIRECTORIES(/usr/local/lib ${PROJECT_BINARY_DIR}/../../lib)
IF (DEFINED ENV{LD_LIBRARY_PATH}) IF (DEFINED ENV{LD_LIBRARY_PATH})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册