diff --git a/.github/expected_results/end2end.txt b/.github/expected_results/end2end.txt deleted file mode 100644 index e0e7f34..0000000 --- a/.github/expected_results/end2end.txt +++ /dev/null @@ -1,141 +0,0 @@ -Table 'tbl' has been created -Data Inserted -Data Inserted -Data Inserted -+----------+------+-------+------+ -| one | two | three | four | -+----------+------+-------+------+ -| 'byebye' | NULL | 33 | 'e' | -+----------+------+-------+------+ -+-----------+-------+ -| one | three | -+-----------+-------+ -| 'hello' | 11 | -| 'goodbye' | 22 | -+-----------+-------+ -+----------+------+-------+------+ -| one | two | three | four | -+----------+------+-------+------+ -| 'byebye' | NULL | 33 | 'e' | -+----------+------+-------+------+ -+-----------+------+-------+------+ -| one | two | three | four | -+-----------+------+-------+------+ -| 'goodbye' | 1 | 22 | 'w' | -| 'byebye' | NULL | 33 | 'e' | -+-----------+------+-------+------+ -+---------+-----+-------+------+ -| one | two | three | four | -+---------+-----+-------+------+ -| 'hello' | 1 | 11 | 'q' | -+---------+-----+-------+------+ -+-----+-----+-------+------+ -| one | two | three | four | -+-----+-----+-------+------+ -+-----+-----+-------+------+ -+---------+-----+-------+------+ -| one | two | three | four | -+---------+-----+-------+------+ -| 'hello' | 1 | 11 | 'q' | -+---------+-----+-------+------+ -+-----------+------+-------+------+ -| one | two | three | four | -+-----------+------+-------+------+ -| 'goodbye' | 1 | 22 | 'w' | -| 'byebye' | NULL | 33 | 'e' | -+-----------+------+-------+------+ -+-----------+-----+-------+------+ -| one | two | three | four | -+-----------+-----+-------+------+ -| 'goodbye' | 1 | 22 | 'w' | -+-----------+-----+-------+------+ -Data from 'tbl' has been deleted -+-----------+-----+-------+------+ -| one | two | three | four | -+-----------+-----+-------+------+ -| 'hello' | 1 | 11 | 'q' | -| 'goodbye' | 1 | 22 | 'w' | -+-----------+-----+-------+------+ -+-----------+ -| one | -+-----------+ -| 'goodbye' | -| 'hello' | -+-----------+ -Table: 'tbl' has been updated -+-----------+------+-------+------+ -| one | two | three | four | -+-----------+------+-------+------+ -| 'hello' | 1 | 11 | 'q' | -| 'goodbye' | NULL | 22 | 'P' | -+-----------+------+-------+------+ -Data Inserted -+-----------+------+-------+------+ -| one | two | three | four | -+-----------+------+-------+------+ -| 'hello' | 1 | 11 | 'q' | -| 'goodbye' | NULL | 22 | 'P' | -| 'goodbye' | 5 | 22 | 'P' | -+-----------+------+-------+------+ -Table: 'tbl' has been dropped -Table 'table1' has been created -Table 'table2' has been created -Data Inserted -Data Inserted -Data Inserted -Data Inserted -+--------------+--------------+ -| table1.value | table2.value | -+--------------+--------------+ -| 'Value1' | NULL | -| NULL | 'Value2' | -| NULL | 'Value3' | -+--------------+--------------+ -+--------------+--------------+ -| table1.value | table2.value | -+--------------+--------------+ -| NULL | 'Value2' | -+--------------+--------------+ -+--------------+--------------+ -| table1.value | table2.value | -+--------------+--------------+ -| 'Value1' | NULL | -| NULL | 'Value2' | -+--------------+--------------+ -+--------------+--------------+ -| table1.value | table2.value | -+--------------+--------------+ -| NULL | 'Value2' | -| NULL | 'Value3' | -+--------------+--------------+ -Data Inserted -+---------+------------+ -| MAX(id) | MAX(value) | -+---------+------------+ -| 3 | Value3 | -+---------+------------+ -+------------+---------+ -| MIN(value) | MIN(id) | -+------------+---------+ -| NULL | 1 | -+------------+---------+ -+----------+-----------+--------------+ -| COUNT(*) | COUNT(id) | COUNT(value) | -+----------+-----------+--------------+ -| 3 | 3 | 2 | -+----------+-----------+--------------+ -+---------+------------+ -| SUM(id) | SUM(value) | -+---------+------------+ -| 6 | 0 | -+---------+------------+ -+---------+------------+ -| AVG(id) | AVG(value) | -+---------+------------+ -| 2 | 0 | -+---------+------------+ -+---------+----+ -| AVG(id) | id | -+---------+----+ -| 2 | 1 | -+---------+----+ diff --git a/.github/workflows/end2end-tests.yml b/.github/workflows/end2end-tests.yml index 66d7bf6..8f6f0c9 100644 --- a/.github/workflows/end2end-tests.yml +++ b/.github/workflows/end2end-tests.yml @@ -25,8 +25,8 @@ jobs: - name: Build run: go build -v - - name: Run - run: ./GO4SQL -file test_file > output.txt + - name: Make Test Script Executable + run: chmod +x e2e/e2e_test.sh - - name: Check Result - run: diff output.txt ./.github/expected_results/end2end.txt + - name: Run Tests + run: e2e/e2e_test.sh diff --git a/README.md b/README.md index 1bb4c95..e673fb5 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,10 @@ You can compile the project with ``go build``, this will create ``GO4SQL`` binar Currently, there are 3 modes to chose from: 1. `File Mode` - You can specify file path with ``./GO4SQL -file file_path``, that will read the - input - data directly into the program and print the result. - + input data directly into the program and print the result. In order to run one of e2e test files you can use: + ```shell + go build; ./GO4SQL -file e2e/test_files/1_select_with_where_test + ``` 2. `Stream Mode` - With ``./GO4SQL -stream`` you can run the program in stream mode, then you provide SQL commands in your console (from standard input). @@ -43,7 +44,15 @@ To run all the tests locally paste this in root directory: go clean -testcache; go test ./... ``` -### Docker +## E2E TESTS + +There are integrated with Github actions e2e tests that can be found in: `.github/workflows/end2end-tests.yml` file. +Tests run files inside `e2e/test_files` directory through `GO4SQL`, save stdout into files, and finally compare +then with expected outputs inside `e2e/expected_outputs` directory. + +To run e2e test locally, you can run script `./e2e/e2e_test.sh` if you're in the root directory. + +## Docker 1. Pull docker image: `docker pull kajedot/go4sql:latest` 2. Run docker container in the interactive mode, remember to provide flag, for example: @@ -302,18 +311,11 @@ go clean -testcache; go test ./... This command will return the average of all values in the numerical column ``columnName`` of ``tableName``. -## E2E TEST - -In root directory there is **test_file** containing input commands for E2E tests. File -**.github/expected_results/end2end.txt** has expected results for it. -This is integrated into github workflows. - ## DOCKER To build your docker image run this command in root directory: -``` -shell +```shell docker build -t go4sql:test . ``` diff --git a/e2e/e2e_test.sh b/e2e/e2e_test.sh new file mode 100644 index 0000000..9dff5ef --- /dev/null +++ b/e2e/e2e_test.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +e2e_failed=false + +for test_file in e2e/test_files/*_test; do + output_file="./e2e/$(basename "${test_file/_test/_output}")" + ./GO4SQL -file "$test_file" > "$output_file" + expected_output="e2e/expected_outputs/$(basename "${test_file/_test/_expected_output}")" + diff "$output_file" "$expected_output" + if [ $? -ne 0 ]; then + echo "E2E test for: {$test_file} failed" + e2e_failed=true + fi + rm "./$output_file" +done + +if [ "$e2e_failed" = true ]; then + echo "E2E tests failed." + exit 1 +else + echo "All E2E tests passed." +fi diff --git a/e2e/expected_outputs/1_select_with_where_expected_output b/e2e/expected_outputs/1_select_with_where_expected_output new file mode 100644 index 0000000..ba58bca --- /dev/null +++ b/e2e/expected_outputs/1_select_with_where_expected_output @@ -0,0 +1,35 @@ +Table 'tbl' has been created +Data Inserted +Data Inserted +Data Inserted ++----------+------+-------+------+ +| one | two | three | four | ++----------+------+-------+------+ +| 'byebye' | NULL | 33 | 'e' | ++----------+------+-------+------+ ++-----------+-------+ +| one | three | ++-----------+-------+ +| 'hello' | 11 | +| 'goodbye' | 22 | ++-----------+-------+ ++----------+------+-------+------+ +| one | two | three | four | ++----------+------+-------+------+ +| 'byebye' | NULL | 33 | 'e' | ++----------+------+-------+------+ ++-----------+------+-------+------+ +| one | two | three | four | ++-----------+------+-------+------+ +| 'goodbye' | 1 | 22 | 'w' | +| 'byebye' | NULL | 33 | 'e' | ++-----------+------+-------+------+ ++---------+-----+-------+------+ +| one | two | three | four | ++---------+-----+-------+------+ +| 'hello' | 1 | 11 | 'q' | ++---------+-----+-------+------+ ++-----+-----+-------+------+ +| one | two | three | four | ++-----+-----+-------+------+ ++-----+-----+-------+------+ diff --git a/e2e/expected_outputs/2_select_with_limit_and_offset_expected_output b/e2e/expected_outputs/2_select_with_limit_and_offset_expected_output new file mode 100644 index 0000000..cea7b84 --- /dev/null +++ b/e2e/expected_outputs/2_select_with_limit_and_offset_expected_output @@ -0,0 +1,20 @@ +Table 'tbl' has been created +Data Inserted +Data Inserted +Data Inserted ++---------+-----+-------+------+ +| one | two | three | four | ++---------+-----+-------+------+ +| 'hello' | 1 | 11 | 'q' | ++---------+-----+-------+------+ ++-----------+------+-------+------+ +| one | two | three | four | ++-----------+------+-------+------+ +| 'goodbye' | 1 | 22 | 'w' | +| 'byebye' | NULL | 33 | 'e' | ++-----------+------+-------+------+ ++-----------+-----+-------+------+ +| one | two | three | four | ++-----------+-----+-------+------+ +| 'goodbye' | 1 | 22 | 'w' | ++-----------+-----+-------+------+ diff --git a/e2e/expected_outputs/3_delete_expected_output b/e2e/expected_outputs/3_delete_expected_output new file mode 100644 index 0000000..f0c6911 --- /dev/null +++ b/e2e/expected_outputs/3_delete_expected_output @@ -0,0 +1,11 @@ +Table 'tbl' has been created +Data Inserted +Data Inserted +Data Inserted +Data from 'tbl' has been deleted ++-----------+-----+-------+------+ +| one | two | three | four | ++-----------+-----+-------+------+ +| 'hello' | 1 | 11 | 'q' | +| 'goodbye' | 1 | 22 | 'w' | ++-----------+-----+-------+------+ diff --git a/e2e/expected_outputs/4_orderby_expected_output b/e2e/expected_outputs/4_orderby_expected_output new file mode 100644 index 0000000..b920afb --- /dev/null +++ b/e2e/expected_outputs/4_orderby_expected_output @@ -0,0 +1,11 @@ +Table 'tbl' has been created +Data Inserted +Data Inserted +Data Inserted ++-----------+ +| one | ++-----------+ +| 'byebye' | +| 'goodbye' | +| 'hello' | ++-----------+ diff --git a/e2e/expected_outputs/5_update_expected_output b/e2e/expected_outputs/5_update_expected_output new file mode 100644 index 0000000..6094e0a --- /dev/null +++ b/e2e/expected_outputs/5_update_expected_output @@ -0,0 +1,12 @@ +Table 'tbl' has been created +Data Inserted +Data Inserted +Data Inserted +Table: 'tbl' has been updated ++-----------+------+-------+------+ +| one | two | three | four | ++-----------+------+-------+------+ +| 'hello' | 1 | 11 | 'q' | +| 'goodbye' | NULL | 22 | 'P' | +| 'byebye' | NULL | 33 | 'e' | ++-----------+------+-------+------+ diff --git a/e2e/expected_outputs/6_select_distinct_expected_output b/e2e/expected_outputs/6_select_distinct_expected_output new file mode 100644 index 0000000..7ed7fb7 --- /dev/null +++ b/e2e/expected_outputs/6_select_distinct_expected_output @@ -0,0 +1,13 @@ +Table 'tbl' has been created +Data Inserted +Data Inserted +Data Inserted +Data Inserted +Data Inserted ++-----------+------+-------+------+ +| one | two | three | four | ++-----------+------+-------+------+ +| 'hello' | 1 | 11 | 'q' | +| 'goodbye' | 1 | 22 | 'w' | +| 'byebye' | NULL | 33 | 'e' | ++-----------+------+-------+------+ diff --git a/e2e/expected_outputs/7_drop_table_expected_output b/e2e/expected_outputs/7_drop_table_expected_output new file mode 100644 index 0000000..b0852d5 --- /dev/null +++ b/e2e/expected_outputs/7_drop_table_expected_output @@ -0,0 +1,2 @@ +Table 'tbl' has been created +Table: 'tbl' has been dropped diff --git a/e2e/expected_outputs/8_select_with_join_expected_output b/e2e/expected_outputs/8_select_with_join_expected_output new file mode 100644 index 0000000..6e9c1df --- /dev/null +++ b/e2e/expected_outputs/8_select_with_join_expected_output @@ -0,0 +1,30 @@ +Table 'table1' has been created +Table 'table2' has been created +Data Inserted +Data Inserted +Data Inserted +Data Inserted ++--------------+--------------+ +| table1.value | table2.value | ++--------------+--------------+ +| 'Value1' | NULL | +| NULL | 'Value2' | +| NULL | 'Value3' | ++--------------+--------------+ ++--------------+--------------+ +| table1.value | table2.value | ++--------------+--------------+ +| NULL | 'Value2' | ++--------------+--------------+ ++--------------+--------------+ +| table1.value | table2.value | ++--------------+--------------+ +| 'Value1' | NULL | +| NULL | 'Value2' | ++--------------+--------------+ ++--------------+--------------+ +| table1.value | table2.value | ++--------------+--------------+ +| NULL | 'Value2' | +| NULL | 'Value3' | ++--------------+--------------+ diff --git a/e2e/expected_outputs/9_aggregate_functions_expected_output b/e2e/expected_outputs/9_aggregate_functions_expected_output new file mode 100644 index 0000000..4be149e --- /dev/null +++ b/e2e/expected_outputs/9_aggregate_functions_expected_output @@ -0,0 +1,36 @@ +Table 'table1' has been created +Table 'table2' has been created +Data Inserted +Data Inserted +Data Inserted +Data Inserted ++---------+------------+ +| MAX(id) | MAX(value) | ++---------+------------+ +| 2 | Value1 | ++---------+------------+ ++------------+---------+ +| MIN(value) | MIN(id) | ++------------+---------+ +| NULL | 1 | ++------------+---------+ ++----------+-----------+--------------+ +| COUNT(*) | COUNT(id) | COUNT(value) | ++----------+-----------+--------------+ +| 2 | 2 | 1 | ++----------+-----------+--------------+ ++---------+------------+ +| SUM(id) | SUM(value) | ++---------+------------+ +| 3 | 0 | ++---------+------------+ ++---------+------------+ +| AVG(id) | AVG(value) | ++---------+------------+ +| 1 | 0 | ++---------+------------+ ++---------+----+ +| AVG(id) | id | ++---------+----+ +| 1 | 1 | ++---------+----+ diff --git a/e2e/test_files/1_select_with_where_test b/e2e/test_files/1_select_with_where_test new file mode 100644 index 0000000..cd8b6ce --- /dev/null +++ b/e2e/test_files/1_select_with_where_test @@ -0,0 +1,12 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +INSERT INTO tbl VALUES( 'hello',1, 11, 'q' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); + +SELECT * FROM tbl WHERE one EQUAL 'byebye'; +SELECT one, three FROM tbl WHERE two NOT NULL; +SELECT * FROM tbl WHERE one NOT 'goodbye' AND two EQUAL NULL; +SELECT * FROM tbl WHERE one IN ('goodbye', 'byebye'); +SELECT * FROM tbl WHERE one NOTIN ('goodbye', 'byebye'); +SELECT * FROM tbl WHERE FALSE; diff --git a/e2e/test_files/2_select_with_limit_and_offset_test b/e2e/test_files/2_select_with_limit_and_offset_test new file mode 100644 index 0000000..51902d1 --- /dev/null +++ b/e2e/test_files/2_select_with_limit_and_offset_test @@ -0,0 +1,9 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +INSERT INTO tbl VALUES( 'hello',1, 11, 'q' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); + +SELECT * FROM tbl LIMIT 1; +SELECT * FROM tbl OFFSET 1; +SELECT * FROM tbl LIMIT 1 OFFSET 1; diff --git a/e2e/test_files/3_delete_test b/e2e/test_files/3_delete_test new file mode 100644 index 0000000..008c84a --- /dev/null +++ b/e2e/test_files/3_delete_test @@ -0,0 +1,9 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +INSERT INTO tbl VALUES( 'hello',1, 11, 'q' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); + +DELETE FROM tbl WHERE one EQUAL 'byebye'; + +SELECT * FROM tbl; diff --git a/e2e/test_files/4_orderby_test b/e2e/test_files/4_orderby_test new file mode 100644 index 0000000..59c27ba --- /dev/null +++ b/e2e/test_files/4_orderby_test @@ -0,0 +1,8 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +INSERT INTO tbl VALUES( 'hello',1, 11, 'q' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); + +SELECT one FROM tbl WHERE TRUE ORDER BY two ASC, four DESC; + diff --git a/e2e/test_files/5_update_test b/e2e/test_files/5_update_test new file mode 100644 index 0000000..4325950 --- /dev/null +++ b/e2e/test_files/5_update_test @@ -0,0 +1,9 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +INSERT INTO tbl VALUES( 'hello',1, 11, 'q' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); + +UPDATE tbl SET two TO NULL, four TO 'P' WHERE one EQUAL 'goodbye'; + +SELECT * FROM tbl; diff --git a/e2e/test_files/6_select_distinct_test b/e2e/test_files/6_select_distinct_test new file mode 100644 index 0000000..0e8a880 --- /dev/null +++ b/e2e/test_files/6_select_distinct_test @@ -0,0 +1,9 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +INSERT INTO tbl VALUES( 'hello',1, 11, 'q' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); +INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); +INSERT INTO tbl VALUES( 'byebye', NULL, 33,'e' ); + +SELECT DISTINCT * FROM tbl; diff --git a/e2e/test_files/7_drop_table_test b/e2e/test_files/7_drop_table_test new file mode 100644 index 0000000..e9b24c3 --- /dev/null +++ b/e2e/test_files/7_drop_table_test @@ -0,0 +1,3 @@ +CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); + +DROP TABLE tbl; diff --git a/e2e/test_files/8_select_with_join_test b/e2e/test_files/8_select_with_join_test new file mode 100644 index 0000000..5362818 --- /dev/null +++ b/e2e/test_files/8_select_with_join_test @@ -0,0 +1,12 @@ +CREATE TABLE table1( id INT, value TEXT); +CREATE TABLE table2( id INT, value TEXT); + +INSERT INTO table1 VALUES(1, 'Value1'); +INSERT INTO table1 VALUES(2, NULL); +INSERT INTO table2 VALUES(2, 'Value2'); +INSERT INTO table2 VALUES(3, 'Value3'); + +SELECT table1.value, table2.value FROM table1 FULL JOIN table2 ON table1.id EQUAL table2.id; +SELECT table1.value, table2.value FROM table1 INNER JOIN table2 ON table1.id EQUAL table2.id; +SELECT table1.value, table2.value FROM table1 LEFT JOIN table2 ON table1.id EQUAL table2.id; +SELECT table1.value, table2.value FROM table1 RIGHT JOIN table2 ON table1.id EQUAL table2.id; diff --git a/e2e/test_files/9_aggregate_functions_test b/e2e/test_files/9_aggregate_functions_test new file mode 100644 index 0000000..07b1262 --- /dev/null +++ b/e2e/test_files/9_aggregate_functions_test @@ -0,0 +1,14 @@ +CREATE TABLE table1( id INT, value TEXT); +CREATE TABLE table2( id INT, value TEXT); + +INSERT INTO table1 VALUES(1, 'Value1'); +INSERT INTO table1 VALUES(2, NULL); +INSERT INTO table2 VALUES(2, 'Value2'); +INSERT INTO table2 VALUES(3, 'Value3'); + +SELECT MAX(id), MAX(value) FROM table1; +SELECT MIN(value), MIN(id) FROM table1; +SELECT COUNT(*), COUNT(id), COUNT(value) FROM table1; +SELECT SUM(id), SUM(value) FROM table1; +SELECT AVG(id), AVG(value) FROM table1; +SELECT AVG(id), id FROM table1; diff --git a/test_file b/test_file deleted file mode 100644 index 8149bf0..0000000 --- a/test_file +++ /dev/null @@ -1,38 +0,0 @@ - CREATE TABLE tbl( one TEXT , two INT, three INT, four TEXT ); - INSERT INTO tbl VALUES( 'hello', 1, 11, 'q' ); - INSERT INTO tbl VALUES( 'goodbye', 1, 22, 'w' ); - INSERT INTO tbl VALUES( 'byebye', NULL, 33, 'e' ); - SELECT * FROM tbl WHERE one EQUAL 'byebye'; - SELECT one, three FROM tbl WHERE two NOT NULL; - SELECT * FROM tbl WHERE one NOT 'goodbye' AND two EQUAL NULL; - SELECT * FROM tbl WHERE one IN ('goodbye', 'byebye'); - SELECT * FROM tbl WHERE one NOTIN ('goodbye', 'byebye'); - SELECT * FROM tbl WHERE FALSE; - SELECT * FROM tbl LIMIT 1; - SELECT * FROM tbl OFFSET 1; - SELECT * FROM tbl LIMIT 1 OFFSET 1; - DELETE FROM tbl WHERE one EQUAL 'byebye'; - SELECT * FROM tbl; - SELECT one FROM tbl WHERE TRUE ORDER BY two ASC, four DESC; - UPDATE tbl SET two TO NULL, four TO 'P' WHERE one EQUAL 'goodbye'; - SELECT * FROM tbl; - INSERT INTO tbl VALUES( 'goodbye', 5, 22, 'P' ); - SELECT DISTINCT * FROM tbl; - DROP TABLE tbl; - CREATE TABLE table1( id INT, value TEXT); - CREATE TABLE table2( id INT, value TEXT); - INSERT INTO table1 VALUES(1, 'Value1'); - INSERT INTO table1 VALUES(2, NULL); - INSERT INTO table2 VALUES(2, 'Value2'); - INSERT INTO table2 VALUES(3, 'Value3'); - SELECT table1.value, table2.value FROM table1 FULL JOIN table2 ON table1.id EQUAL table2.id; - SELECT table1.value, table2.value FROM table1 INNER JOIN table2 ON table1.id EQUAL table2.id; - SELECT table1.value, table2.value FROM table1 LEFT JOIN table2 ON table1.id EQUAL table2.id; - SELECT table1.value, table2.value FROM table1 RIGHT JOIN table2 ON table1.id EQUAL table2.id; - INSERT INTO table1 VALUES(3, 'Value3'); - SELECT MAX(id), MAX(value) FROM table1; - SELECT MIN(value), MIN(id) FROM table1; - SELECT COUNT(*), COUNT(id), COUNT(value) FROM table1; - SELECT SUM(id), SUM(value) FROM table1; - SELECT AVG(id), AVG(value) FROM table1; - SELECT AVG(id), id FROM table1; \ No newline at end of file