how to make a join with show database

Viewed 35

I want make a join with show database because I would like to find in a table of a database that has for column name if the name of the databases are present in this column

Ex:

select name 
from clients 
where db_client not in (select Database from show databases)
1 Answers

Something like below maybe :

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.25    |
+-----------+
1 row in set (0.00 sec)

mysql> select * from clients;
+--------+-------+-----------+
| nameId | name  | db_client |
+--------+-------+-----------+
|      1 | Maria | gesti     |
|      2 | John  | sakila    |
+--------+-------+-----------+
2 rows in set (0.00 sec)

mysql>
mysql>
mysql>  select name  from clients where db_client not in (select TABLE_SCHEMA from  information_schema.COLUMNS where TABLE_SCHEMA='gesti');
+------+
| name |
+------+
| John |
+------+
1 row in set (0.00 sec)
Related