mysql query to check record exists in database table or not

Solutions on MaxInterview for mysql query to check record exists in database table or not by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
showing results for - "mysql query to check record exists in database table or not"
Fay
17 Jun 2018
1-- Returns 1 if exists, 0 else
2SELECT EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%');
3
4SELECT 
5	CASE 
6		WHEN EXISTS(SELECT 1 FROM my_table WHERE text LIKE '%something%') = 1 THEN
7    		'It exists'
8    	ELSE 'Does not exist'
9	END;