david@intel-compute-stick:~$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 894
Server version: 10.5.12-MariaDB-0+deb11u1 Debian 11
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE test065;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> USE test065;
Database changed
MariaDB [test065]> CREATE TABLE a (n1 INTEGER, n2 INTEGER);
Query OK, 0 rows affected (0.059 sec)
MariaDB [test065]> CREATE TABLE b (n3 INTEGER, n4 INTEGER);
Query OK, 0 rows affected (0.064 sec)
MariaDB [test065]> INSERT INTO a VALUES (0, 0);
Query OK, 1 row affected (0.032 sec)
MariaDB [test065]> INSERT INTO a VALUES (0, 1);
Query OK, 1 row affected (0.029 sec)
MariaDB [test065]> INSERT INTO a VALUES (1, 0);
Query OK, 1 row affected (0.028 sec)
MariaDB [test065]> INSERT INTO a VALUES (1, 1);
Query OK, 1 row affected (0.028 sec)
MariaDB [test065]> INSERT INTO a VALUES (0, 2);
Query OK, 1 row affected (0.035 sec)
MariaDB [test065]> INSERT INTO b VALUES (0, 0);
Query OK, 1 row affected (0.032 sec)
MariaDB [test065]> INSERT INTO b VALUES (0, 1);
Query OK, 1 row affected (0.033 sec)
MariaDB [test065]> INSERT INTO b VALUES (0, 2);
Query OK, 1 row affected (0.004 sec)
MariaDB [test065]> SELECT * FROM a;
+------+------+
| n1 | n2 |
+------+------+
| 0 | 0 |
| 0 | 1 |
| 1 | 0 |
| 1 | 1 |
| 0 | 2 |
+------+------+
5 rows in set (0.001 sec)
MariaDB [test065]> SELECT * FROM b;
+------+------+
| n3 | n4 |
+------+------+
| 0 | 0 |
| 0 | 1 |
| 0 | 2 |
+------+------+
3 rows in set (0.001 sec)
MariaDB [test065]> SELECT * FROM a JOIN b;
+------+------+------+------+
| n1 | n2 | n3 | n4 |
+------+------+------+------+
| 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 2 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 2 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 0 | 2 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 0 | 2 |
| 0 | 2 | 0 | 0 |
| 0 | 2 | 0 | 1 |
| 0 | 2 | 0 | 2 |
+------+------+------+------+
15 rows in set (0.001 sec)
MariaDB [test065]> SELECT * FROM a INNER JOIN b ON a.n1 = b.n3;
+------+------+------+------+
| n1 | n2 | n3 | n4 |
+------+------+------+------+
| 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 2 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 2 |
| 0 | 2 | 0 | 0 |
| 0 | 2 | 0 | 1 |
| 0 | 2 | 0 | 2 |
+------+------+------+------+
9 rows in set (0.002 sec)
MariaDB [test065]> SELECT * FROM a RIGHT JOIN b ON a.n1 = b.n3;
+------+------+------+------+
| n1 | n2 | n3 | n4 |
+------+------+------+------+
| 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 2 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 2 |
| 0 | 2 | 0 | 0 |
| 0 | 2 | 0 | 1 |
| 0 | 2 | 0 | 2 |
+------+------+------+------+
9 rows in set (0.002 sec)
MariaDB [test065]> SELECT * FROM a LEFT JOIN b ON a.n1 = b.n3;
+------+------+------+------+
| n1 | n2 | n3 | n4 |
+------+------+------+------+
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 2 | 0 | 0 |
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 2 | 0 | 1 |
| 0 | 0 | 0 | 2 |
| 0 | 1 | 0 | 2 |
| 0 | 2 | 0 | 2 |
| 1 | 0 | NULL | NULL |
| 1 | 1 | NULL | NULL |
+------+------+------+------+
11 rows in set (0.002 sec)
MariaDB [test065]> SQUKT
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SQUKT' at line 1
MariaDB [test065]> QUIT;
Bye
david@intel-compute-stick:~$