Answers for "mysql query to check if db exists"

SQL
2

sqlalchemy check if database exists

# pip install sqlalchemy-utils

from sqlalchemy_utils.functions import database_exists

if database_exists(app.config["SQLALCHEMY_DATABASE_URI"]):
    # do stuff
Posted by: Guest on August-25-2020
0

mysql query to check record exists in database table or not

-- Returns 1 if exists, 0 else
SELECT EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%');

SELECT 
	CASE 
		WHEN EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%') = 1 THEN
    		'It exists'
    	ELSE 'Does not exist'
	END;
Posted by: Guest on April-23-2021

Code answers related to "mysql query to check if db exists"

Code answers related to "SQL"

Browse Popular Code Answers by Language