Posts Tagged ‘null’

Consider the following query (tested on PostgreSQL – some other systems may require a table to be specified): SELECT ‘Yes’ AS Value_Returned WHERE 1 != 2; This query returns 1 row: ( Value_Returned = ‘Yes’ ), as one would expect. But what if we compare against NULL? SELECT ‘Yes’ AS Value_Returned WHERE 1 != NULL; […]

In Bash you quite often need to check to see if a variable has been set or has a value other than an empty string. This can be done using the -n or -z string comparison operators. The -n operator checks whether the string is not null. Effectively, this will return true for every case […]