Page 1 of 1

how to check if a database has been created

Posted: Tue Jul 20, 2004 11:23 am
by davidklonski
Hello

Is it possible to test if a certain database has been created using SQL?
if so, how can it be done?
The query is obvisouly on the MySQL level and not on a certain database.

thanks

Posted: Tue Jul 20, 2004 11:29 am
by feyd

Code: Select all

SHOW STATUS TABLE LIKE 'tablename'
or

Code: Select all

CREATE TABLE IF NOT EXISTS .........

Posted: Tue Jul 20, 2004 11:35 am
by davidklonski
doesn't that test the status of a table?
I was looking for a way of knowing whether a DATABASE exists

thanks

Posted: Tue Jul 20, 2004 11:38 am
by feyd
hmm I could have swore you said table.. :oops:

Code: Select all

SHOW DATABASES їLIKE 'pattern']

Posted: Tue Jul 20, 2004 11:51 am
by davidklonski
thanks for the help