3 Ways to Return Distinct Values in MongoDB

Distinct values are those values with redundant duplicates removed. In other words, distinct values are unique values.

In MongoDB there are a few ways we can return distinct values in a query. This article presents 3 ways to return distinct values in the mongo shell.

Read more

How POSITION() Works in MariaDB

In MariaDB, POSITION() is a built-in string function that returns the position of the first occurrence of a substring within another string. It’s part of ODBC 3.0.

POSITION(substr IN str) is a synonym for LOCATE(substr,str).

POSITION() is also similar to the INSTR() function, except that POSITION() uses the IN syntax, and that the argument order is reversed between these two functions.

Read more

How QUOTE() Works in MariaDB

In MariaDB, QUOTE() is a built-in string function that allows you to escape a string so that it’s suitable for inclusion in an SQL statement.

The string is returned enclosed by single quotes, and a backslash is prepended to each instance of single quote ('), backslash (\), ASCII NUL, and Control-Z characters.

Read more

MariaDB SUBSTR() Explained

In MariaDB, SUBSTR() is a synonym for SUBSTRING().

It’s a built-in string function that returns a substring from a given string.

It requires at least two arguments; the string, and the position for which to extract the substring from. It also accepts an optional third argument that allows you to specify how long the substring should be.

Read more

How SUBSTRING() Works in MariaDB

In MariaDB, SUBSTRING() is a built-in string function that returns a substring from a given string.

SUBSTRING() requires at least two arguments; the string, and the position for which to extract the substring from. It also accepts an optional third argument that allows you to specify how long the substring should be.

Read more

3 Ways to Drop an Index in MongoDB

MongoDB provides several ways to drop an index or indexes.

To drop a single index, you can use the dropIndex() method.

To drop multiple indexes, you can use either the dropIndexes() method or the dropIndexes administration command.

Read more