Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql default value if null

SELECT IFNULL(column_name, default_value 'Test') AS alias FROM table; 
--example
SELECT
        first_name,
        IFNULL(title, 'MISSING') as title,
        IFNULL(grade, 0) as grade
FROM students
Comment

PREVIOUS NEXT
Code Example
Sql :: bigquery current time 
Sql :: count in sql 
Sql :: oracle sql unique 
Sql :: insert many to many sql 
Sql :: forcefully delete a row in mysql which has references 
Sql :: how to select all fieldsin a soql query 
Sql :: copy column from one table to another without column duplicate postgres 
Sql :: sql group by example 
Sql :: postgresql select case insensitive 
Sql :: See Foreign Key 
Sql :: not between mysql 
Sql :: how to comment in sql 
Sql :: mysql is odd 
Sql :: get current date sql 
Sql :: copy from one table to another postgres using matching column 
Sql :: count weekend days between two dates sql 
Sql :: DELETE DUPLICATE VALUES FROM A TABLE IN SQL SERVER 
Sql :: open postgresql.conf in centos 
Sql :: ERROR: permission denied for table accounts postgresql 13 
Sql :: what is unique key in sql 
Sql :: SQL get max per id 
Sql :: connect to mysql server mac terminal 
Sql :: grant select mysql 
Sql :: oracle boolean to varchar 
Sql :: postgres show table schema 
Sql :: tsql from yyyymm to date 
Sql :: oracle create index if not exists 
Sql :: oracle synonym procedure 
Sql :: SQL IN Operator With Subquery 
Sql :: mysql create view 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =