Search
 
SCRIPT & CODE EXAMPLE
 

SQL

check if record exists mysql

-- 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;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql add root password 
Sql :: delete temp table if exists 
Sql :: add column with foreign key constraint sql server 
Sql :: mysql version query 
Sql :: show tables in cassandra cql 
Sql :: postgres populate table from another table 
Sql :: get name of day in sql 
Sql :: sql server sleep 
Sql :: sql not equal multiple columns 
Sql :: get server date mysql 
Sql :: drop table with constraints 
Sql :: copy postgres table from one schema into another 
Sql :: connectionstring mysql c# 
Sql :: drop view sql 
Sql :: mysql grant access to one database 
Sql :: how to get the date diff on once field in sql server 
Sql :: how to drop all tables in postgresql 
Sql :: postgresql create query 
Sql :: postgresql export database 
Sql :: add current timestamp in mysql 
Sql :: script sql backup database sql server 
Sql :: t sql null or empty string 
Sql :: sql get month from date 
Sql :: sqlite show table indexes 
Sql :: sql views 
Sql :: sql pad left 0 
Sql :: postgres list users and roles 
Sql :: ValueError: A string literal cannot contain NUL (0x00) characters. 
Sql :: oracle apex view logs 
Sql :: sql groub by count 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =