How Group_Concat() Works in SQLite

SQLite has a group_concat() function that allows you to concatenate multiple results returned for a column into one.

This is sometimes referred to as “string aggregation”.

For example, when querying a database, instead of having each column’s value output in a new row, you can use group_concat() to have them output as a comma separated list.

Read more

How Round() Works in SQLite

In SQLite, the round() function allows you to round numbers up or down to a given decimal place.

It returns a floating-point value from the first argument, with the number of decimal places that you specify in the (optional) second argument.

If you don’t provide the second argument, it’s assumed to be 0.

Read more

How SQLite Nullif() Works

The SQLite nullif() function is a handy function that allows you to treat certain values as NULL when required.

It’s not to be confused with the ifnull() function, which does the opposite – enables you to treat NULL values as something else.

The nullif() function accepts two arguments, and returns its first argument if the arguments are different and NULL if the arguments are the same.

Read more

How SQLite Random() Works

The SQLite random() function returns a pseudo-random integer between -9223372036854775808 and +9223372036854775807.

A pseudo-random number is a number that appears to be random, but is not truely random. A pseudo-random number is not truely random because its value was generated by a known seed. However, a pseudo-random number will appear to be random if the user has no knowledge of the seed or algorithm that created it.

Therefore, pseudo-random numbers are often considered good enough for many applications.

Read more

How SQLite Trim() Works

The SQLite trim() function trims whitespace or other characters from both sides of a string.

The function returns a copy of the string that you provide as an argument, with either whitespace, or other characters as specified, trimmed from both sides.

Read more