PostgreSQL has an ALL() construct that we can use when searching for data inside arrays. It returns a Boolean result, which reflects whether the condition is true or not.
Using the ANY() Construct in PostgreSQL
In PostgreSQL, we can use the ANY() construct to perform searches against arrays. It returns a Boolean result, and so we can incorporate this into our searches to return just those rows that yield true or false, as the case may be.
There’s also a SOME() construct, which is a synonym for ANY().
2 Ways to Drop an Event in MySQL
In MySQL, scheduled events are tasks that run according to a specified schedule. When we no longer require an event we can drop it so that it doesn’t take up unnecessary room in the system. We have a couple of ways of going about this.
Understanding the ARRAY_UPPER() Function in PostgreSQL
In PostgreSQL, the array_upper() function returns the upper bound of the specified array dimension. We pass the array as well as the dimension, and it returns the upper bound accordingly.
A Quick Intro to the ARRAY_LOWER() Function in PostgreSQL
In PostgreSQL, the array_lower() function returns the lower bound of the specified array dimension. We pass the array and the relevant dimension, and it returns the lower bound for that dimension.
A Quick Overview of ARRAY_NDIMS() in PostgreSQL
In PostgreSQL the array_ndims() function returns the number of dimensions of an array. We pass the array to the function, and it returns an integer of the number of dimensions in the array.
This function is not to be confused with the array_dims() function, which returns a more detailed text representation of the dimensions in the array.
Fix “sample size must be between…” Error when using array_sample() in PostgreSQL
If you’re getting an error that starts with “sample size must be between…” when using the array_sample() function in PostgreSQL, it’s probably because your second argument is either a negative value, or it’s larger than the number of elements in the array.
The second argument must be no less than zero, and it can’t be any larger than the number of elements in the array.
To fix this error, be sure that your second argument is greater than zero and less than or equal to the number of elements in the array at the first argument.
Understanding ARRAY_DIMS() in PostgreSQL
In PostgreSQL we can use the array_dims() function to return information about the dimensions in an array. The function accepts the array in question, and it returns a text representation of the array’s dimensions.
This function is not to be confused with the array_ndims() function, which simply returns the number of dimensions in an array.
PostgreSQL RANDOM_NORMAL() Function Explained
In PostgreSQL we can use the random_normal() function to generate a normally-distributed random number.
A normally-distributed random number is a random variable with a Gaussian distribution. This is said to be normally distributed, and is referred to as a normal deviate.
Understanding Arrays in PostgreSQL
In PostgreSQL we have the ability to create variable-length multidimensional arrays and define columns as array types.
Here’s a quick overview of PostgreSQL arrays.