Search
 
SCRIPT & CODE EXAMPLE
 

SQL

if in mysql

The if accept one condition, if this condition is true then the true_value will occur 
else the false_value will occur.
IF(condition, true_value, false_value)
Tips : can be to update some data
Comment

mysql if

SELECT user_display_image AS user_image,
       user_display_name AS user_name,
       invitee_phone,
       (CASE WHEN invitee_status = 1 THEN "attending"
             WHEN invitee_status = 2 THEN "unsure"
             WHEN invitee_status = 3 THEN "declined"
             WHEN invitee_status = 0 THEN "notreviwed"
       END) AS invitee_status
  FROM your_table
Comment

if mysql

SELECT IF(500<1000, "YES", "NO");
Comment

mysql if statement

-- PL/SQL
BEGIN
    IF my_val = 1 THEN [...]
    ELSE [...]
    END IF;
END;
-- In a query
SELECT CASE WHEN my_col = 1 THEN 'Ok' ELSE 'Ko' END AS my_result;
Comment

mysql if statement in where clause

SELECT  `id` ,  `naam` 
FROM  `klanten` 
WHERE IF(`email` != '', `email`, `email2`) LIKE  '%@domain.nl%'
Comment

PREVIOUS NEXT
Code Example
Sql :: postgresql subtract date/hours 
Sql :: postgresql not case sensitive where in 
Sql :: pyspark sql row get value 
Sql :: primary key multiple colums 
Sql :: Inner join - to join 3 tables - https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-inner-join/ 
Sql :: postgressql uuid 
Sql :: alter column set not null to null postgres 
Sql :: change user mysql password 
Sql :: rename table sqlite 
Sql :: MySQL get all previous date record 
Sql :: sql server previous month 
Sql :: upper case sql 
Sql :: sql order by alphabetical 
Sql :: orcale index size 
Sql :: change password postgres pgserver 
Sql :: how to import pymysql through jupyter notebook for windows 
Sql :: mysql auerries to find the name starting with vowel letter 
Sql :: mysql change value 
Sql :: how to find special characters in sql 
Sql :: Client does not support authentication protocol requested by server; consider upgrading MySQL client 
Sql :: SQL Duplicates by Composite 
Sql :: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "con" is null 
Sql :: insert in to table sql 
Sql :: sql select if two columns are equal 
Sql :: insert into auto increment mysql 
Sql :: sql column name 
Sql :: oracle default date format 
Sql :: postgres sum when 
Sql :: SQL SELECT DISTINCT Statement 
Sql :: select case when oracle 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =