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 :: restore postgres database from dump 
Sql :: order by oracle 
Sql :: mysql date time string format python 
Sql :: where date = max(date) in sql 
Sql :: sql string data type 
Sql :: python sqlalchemy connection show server 
Sql :: update field sql 
Sql :: is mysql and sqlite same 
Sql :: sql view where tables have same column name combine results 
Sql :: SQLSTATE[IMSSP]: The active result for the query contains no fields. 
Sql :: mysql extract month from date 
Sql :: postgres copy table from one schema to another 
Sql :: postgresql create user 
Sql :: permission denied postgres copy csv command line 
Sql :: get all tables using like 
Sql :: how to connect to xampp sql server on windows cmd 
Sql :: postgres delete all tables 
Sql :: how to truncate table with foreign key constraint postgresql 
Sql :: postgres create extension if not exists 
Sql :: savepoint in sql 
Sql :: date format in postgresql 
Sql :: sql round down to nearest integer 
Sql :: mysql count with if 
Sql :: sqlite indexes 
Sql :: create view in sql 
Sql :: sql select most frequent value in column 
Sql :: temp table vs variable table in sql server 
Sql :: mysql delete table with foreign key 
Sql :: use float in sql server string 
Sql :: psql create user 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =