SQL Listing Databases.
Using SQL statement to list all databases
To list all the databases you must have privileges to use statements for that.
Listing databases in MySQL
In MySQL you can use the SHOW statement.
SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr]
SHOW DATABASES LIKE 'f%'
This will list all the databases which have a name that start with a 'f' character. You can accomplish the same thing with using a where statement.
SHOW DATABASES WHERE `database` LIKE 'f%'
Observe the special single quotes around the database column.
Listing databases in SQL server
In SQL server you can select name from master.dbo.sysdatabases.
SELECT name FROM master.dbo.sysdatabases
WHERE name LIKE 'C%'
This will list all the databases which have a name that start with a 'C' character.
Listing databases in PostgreSQL
In SQL server you can select datname from pg_database.
SELECT datname FROM pg_database
WHERE datname LIKE 'C%'
This will list all the databases which have a datname that start with a 'C' character.
Listing databases in Oracle
A database in Oracle is something completely different than e.g. in SQL Server, PostgrSQL or MySQL.
Each database is (more or less) a different Oracle installation.
To show the database name you must login with the DBA privilege as user SYSTEM for instance.
SELECT NAME FROM v$database