‘master..sysdatabases’ SQL Server syntax equivalent in MySQL

I am converting an SQL Server stored procedure to MySQL and there is the below code line in one stored procedure:

declare c1 cursor static for
      select name from master..sysdatabases 
      where left(name,3) in ('ADM','ENT','DEM')
      order by name asc

What is the functionality of ‘master..sysdatabases ‘? What is the equivalent syntax for master..sysdatabases in MySQL?

Answer

what is the functionality of ‘master..sysdatabases ‘?

SQL server divides databases into

1.User databases
2.System databases..

User database are the ones which users created,system databases(master,model,tempdb,msdb )are the one which comes with SQL installation..

In this case,user is trying to query all available database names matching them with string functions..

In MYSQL,you can use this..

select * from information_schema.SCHEMATA

http://dev.mysql.com/doc/refman/5.7/en/schemata-table.html

Leave a Reply

Your email address will not be published. Required fields are marked *