How to list all the databases on a SQL server

You can list all the databases on a SQL server by running the following query.

SQL> select name from sys.sysdatabases