MariaDB [(none)]> use toyu Database changed MariaDB [toyu]> MariaDB [toyu]> MariaDB [toyu]> @stuId = '' -> ; 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 '@stuId = ''' at line 1 MariaDB [toyu]> set @stuId = ''; Query OK, 0 rows affected (0.001 sec) MariaDB [toyu]> SELECT stuId FROM student; +--------+ | stuId | +--------+ | 100003 | | 100007 | | 100008 | | 100000 | | 100001 | | 100002 | | 100005 | | 100006 | | 100004 | | 100009 | | 100111 | +--------+ 11 rows in set (0.009 sec) MariaDB [toyu]> SELECT stuId FROM student INTO @stuId; ERROR 1172 (42000): Result consisted of more than one row MariaDB [toyu]> SELECT GROUP_CONCAT(stuId) INTO @sutIDs FROM student; Query OK, 1 row affected (0.005 sec) MariaDB [toyu]> select @stuIDs; +---------+ | @stuIDs | +---------+ | NULL | +---------+ 1 row in set (0.002 sec) MariaDB [toyu]> SELECT GROUP_CONCAT(stuId) INTO @sutids FROM student; Query OK, 1 row affected (0.001 sec) MariaDB [toyu]> SELECT GROUP_CONCAT(stuId) INTO @stuids FROM student; Query OK, 1 row affected (0.000 sec) MariaDB [toyu]> SELECT @stuIds; +------------------------------------------------------------------------------+ | @stuIds | +------------------------------------------------------------------------------+ | 100003,100007,100008,100000,100001,100002,100005,100006,100004,100009,100111 | +------------------------------------------------------------------------------+ 1 row in set (0.001 sec) MariaDB [toyu]> show databases; +--------------------+ | Database | +--------------------+ | ctetinker | | dbtool | | ds | | information_schema | | mysql | | performance_schema | | phpmyadmin | | swim | | toyu | +--------------------+ 9 rows in set (0.002 sec) MariaDB [toyu]> SELECT DISTINCT u.user, u.password -> FROM mysql.user AS u -> WHERE u.host = 'localhost'; +-------+-------------------------------------------+ | User | Password | +-------+-------------------------------------------+ | d5333 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | demo | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | pma | | | root | | | s1 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | s2 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | yue | *0BE23F42F79ABCFD46E7AF357A07122B6C495EA8 | +-------+-------------------------------------------+ 7 rows in set (0.025 sec) MariaDB [toyu]> MariaDB [toyu]> SELECT DISTINCT u.host, u.user, u.password -> FROM mysql.user AS u; +-----------+-------+-------------------------------------------+ | Host | User | Password | +-----------+-------+-------------------------------------------+ | localhost | root | | | % | yue | *0BE23F42F79ABCFD46E7AF357A07122B6C495EA8 | | 127.0.0.1 | root | | | ::1 | root | | | localhost | pma | | | localhost | yue | *0BE23F42F79ABCFD46E7AF357A07122B6C495EA8 | | % | demo | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | localhost | demo | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | % | s1 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | localhost | s1 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | % | s2 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | localhost | s2 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | % | d5333 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | | localhost | d5333 | *C2D24DCA38E9E862098B85BF0AB35CAA52803797 | +-----------+-------+-------------------------------------------+ 14 rows in set (0.003 sec) MariaDB [toyu]> SELECT table_name, table_type, row_format, table_rows, avg_row_length -> FROM information_schema.tables -> WHERE table_schema = 'toyu' -> ORDER BY table_name DESC; +----------------+------------+------------+------------+----------------+ | table_name | table_type | row_format | table_rows | avg_row_length | +----------------+------------+------------+------------+----------------+ | student | BASE TABLE | Dynamic | 11 | 1489 | | school_summary | VIEW | NULL | NULL | NULL | | school | BASE TABLE | Dynamic | 4 | 4096 | | grade | BASE TABLE | Dynamic | 15 | 1092 | | faculty | BASE TABLE | Dynamic | 11 | 1489 | | enroll | BASE TABLE | Dynamic | 22 | 744 | | department | BASE TABLE | Dynamic | 7 | 2340 | | course | BASE TABLE | Dynamic | 11 | 1489 | | class | BASE TABLE | Dynamic | 14 | 1170 | +----------------+------------+------------+------------+----------------+ 9 rows in set (0.002 sec) MariaDB [toyu]> SELECT table_name, table_type, row_format, table_rows, avg_row_length -> FROM information_schema.tables -> WHERE table_schema = 'toyu' -> AND table_type = 'BASE TYPE' -> ORDER BY table_name DESC; Empty set (0.002 sec) MariaDB [toyu]> SELECT table_name, table_type, row_format, table_rows, avg_row_length -> FROM information_schema.tables -> WHERE table_schema = 'toyu' -> AND table_type = 'BASE TABLE' -> ORDER BY table_name DESC; +------------+------------+------------+------------+----------------+ | table_name | table_type | row_format | table_rows | avg_row_length | +------------+------------+------------+------------+----------------+ | student | BASE TABLE | Dynamic | 11 | 1489 | | school | BASE TABLE | Dynamic | 4 | 4096 | | grade | BASE TABLE | Dynamic | 15 | 1092 | | faculty | BASE TABLE | Dynamic | 11 | 1489 | | enroll | BASE TABLE | Dynamic | 22 | 744 | | department | BASE TABLE | Dynamic | 7 | 2340 | | course | BASE TABLE | Dynamic | 11 | 1489 | | class | BASE TABLE | Dynamic | 14 | 1170 | +------------+------------+------------+------------+----------------+ 8 rows in set (0.002 sec) MariaDB [toyu]> ; ERROR: No query specified MariaDB [toyu]> SELECT table_name, table_type, row_format, table_rows, avg_row_length, create_time -> FROM information_schema.tables -> WHERE table_schema = 'toyu' -> AND table_type = 'BASE TABLE' -> ORDER BY table_name DESC; +------------+------------+------------+------------+----------------+---------------------+ | table_name | table_type | row_format | table_rows | avg_row_length | create_time | +------------+------------+------------+------------+----------------+---------------------+ | student | BASE TABLE | Dynamic | 11 | 1489 | 2024-09-25 17:17:41 | | school | BASE TABLE | Dynamic | 4 | 4096 | 2024-09-25 17:17:41 | | grade | BASE TABLE | Dynamic | 15 | 1092 | 2024-09-25 17:17:41 | | faculty | BASE TABLE | Dynamic | 11 | 1489 | 2024-09-25 17:17:41 | | enroll | BASE TABLE | Dynamic | 22 | 744 | 2024-09-25 17:17:41 | | department | BASE TABLE | Dynamic | 7 | 2340 | 2024-09-25 17:17:41 | | course | BASE TABLE | Dynamic | 11 | 1489 | 2024-09-25 17:17:41 | | class | BASE TABLE | Dynamic | 14 | 1170 | 2024-09-25 17:17:41 | +------------+------------+------------+------------+----------------+---------------------+ 8 rows in set (0.003 sec) MariaDB [toyu]> -- databases and tables MariaDB [toyu]> SELECT t.TABLE_SCHEMA AS `schema`, COUNT(t.TABLE_NAME) AS num_tables -> FROM information_schema.tables AS t -> GROUP BY `schema` -> ORDER BY num_tables DESC; +--------------------+------------+ | schema | num_tables | +--------------------+------------+ | information_schema | 79 | | performance_schema | 52 | | mysql | 31 | | phpmyadmin | 19 | | swim | 13 | | toyu | 9 | | ds | 1 | +--------------------+------------+ 7 rows in set (0.003 sec) MariaDB [toyu]> SELECT t.TABLE_SCHEMA AS `schema`, t.ENGINE, COUNT(t.TABLE_NAME) AS num_tables -> FROM information_schema.tables t -> GROUP BY `schema`, t.ENGINE -> ORDER BY `schema`, num_tables DESC; +--------------------+--------------------+------------+ | schema | ENGINE | num_tables | +--------------------+--------------------+------------+ | ds | InnoDB | 1 | | information_schema | MEMORY | 66 | | information_schema | Aria | 13 | | mysql | Aria | 24 | | mysql | InnoDB | 4 | | mysql | CSV | 2 | | mysql | NULL | 1 | | performance_schema | PERFORMANCE_SCHEMA | 52 | | phpmyadmin | InnoDB | 19 | | swim | InnoDB | 13 | | toyu | InnoDB | 8 | | toyu | NULL | 1 | +--------------------+--------------------+------------+ 12 rows in set (0.123 sec) MariaDB [toyu]> CALL count_columns('toyu', 'student', @column_count); ERROR 1305 (42000): PROCEDURE toyu.count_columns does not exist MariaDB [toyu]> SELECT @column_count; +---------------+ | @column_count | +---------------+ | NULL | +---------------+ 1 row in set (0.000 sec) MariaDB [toyu]> CALL count_columns('swim', 'swimmer', @column_count); ERROR 1305 (42000): PROCEDURE toyu.count_columns does not exist MariaDB [toyu]> SELECT @column_count; +---------------+ | @column_count | +---------------+ | NULL | +---------------+ 1 row in set (0.000 sec) MariaDB [toyu]> USE dbtool; Database changed MariaDB [dbtool]> CALL count_columns('toyu', 'student', @column_count); Query OK, 1 row affected (0.015 sec) MariaDB [dbtool]> SELECT @column_count; +---------------+ | @column_count | +---------------+ | 7 | +---------------+ 1 row in set (0.000 sec) MariaDB [dbtool]> CALL count_columns('swim', 'swimmer', @column_count); Query OK, 1 row affected (0.011 sec) MariaDB [dbtool]> SELECT @column_count; +---------------+ | @column_count | +---------------+ | 10 | +---------------+ 1 row in set (0.000 sec) MariaDB [dbtool]> notee