Question : I have a few tables with nullable columns in a SQL Server database. Those nullable attributes are either […]
Tag: null
MySQL Varchar Primary Key With Not Null Constraint Accepting Nulls
Question : I have the following table definition: CREATE TABLE `invite` ( `id` varchar(255) CHARACTER SET utf8 NOT NULL, `email` […]
Test if any columns are NULL
Question : I’m trying to figure out an easy query I can do to test if a large table has […]
SSIS / SSAS: Handling Age Columns
Question : I have some columns representing Age in a table, taking values from 0 to 100, but also -1 […]
Return a default value in group by if selected column is null
Question : I am trying to run a group by statement which works fine however, one of the “group” is […]
CHECK constraint for array column to verify length > 0
Question : I’m playing with postgres table validation rules and trying to set a CHECK constraint for an array column. […]
Why does coalescing make this query quicker?
Question : I have the following query SELECT SQL_NO_CACHE `table1`.* FROM `table1` LEFT JOIN `table2` ON table2.id = table1.table2_id WHERE […]
Count NULL values per row
Question : I would like to count the number of null’s present per row in a table without enumerating column […]
Adding hstore entries to an uninitialized (NULL) column
Question : I got bitten by this “feature” recently. If your hstore column is uninitialized and you start adding entries […]
How to get 0 as array_length() result when there are no elements
Question : I have a query like this: select id, array_length(users_who_like_ids,1) as ct from queryables order by 2 desc; But […]