In Redis, the ZLEXCOUNT
command returns the number of elements in a sorted set with a value between two given values. It can be used when we force lexicographical ordering by applying the same score to all members of a sorted set.
Tag: what is
How LAST_INSERT_ID() Works in MySQL
In MySQL, the LAST_INSERT_ID()
function returns the first automatically generated value successfully inserted for an AUTO_INCREMENT
column as a result of the most recently executed INSERT
statement.
It can also be called with an argument, in which case, it returns the value of the expression and the next call to LAST_INSERT_ID()
will return the same value.
How GENERATE_SERIES() Works in PostgreSQL
In PostgreSQL, we can use the generate_series()
function to return a series of values between a given start and stop point. This can be a series of numbers or a series of timestamps.
The function returns a set containing the series.
Continue readingMySQL ICU_VERSION() Explained
In MySQL, the ICU_VERSION()
function returns the version of the International Components for Unicode (ICU) library used to support regular expression operations.
The ICU_VERSION()
function is primarily intended for use in test cases.
How CURRENT_ROLE() Works in MySQL
In MySQL, CURRENT_ROLE()
is a built-in function that returns the current active roles for the current session, separated by commas, or NONE
if there are none. The current role determines our access privileges.
MySQL COERCIBILITY() Explained
In MySQL, the COERCIBILITY()
returns the collation coercibility value of its string argument.
The COERCIBILITY()
function defines how collations will be converted in the case of collation conflict. In such conflicts, an expression with a higher coercibility is converted to the collation of an expression with a lower coercibility.
How CONNECTION_ID() Works in MySQL
The MySQL CONNECTION_ID()
function returns the connection ID (thread ID) for the connection.
In MySQL, every connection has an ID that is unique among the set of currently connected clients. We can use the CONNECTION_ID()
function to return that ID.
How SETVAL() Works in PostgreSQL
In PostgreSQL, we can use the setval()
function to set a sequence’s value.
We specify the value when we call the function. We also have the option of setting its is_called
flag.
SQL Server FOR XML Explained
In SQL Server, the FOR XML
clause allows us to return the results of a query as an XML document.
When we use this clause, we have various options for how we want to shape the resulting XML document.
Below is an explanation of how the FOR XML
clause works, including the basic options we have when using it.
How CURRVAL() Works in PostgreSQL
In PostgreSQL, the currval()
function returns the value most recently returned by nextval()
for the specified sequence in the current session.
The currval()
function is very similar to the lastval()
function, except that lastval()
doesn’t require the name of a sequence like currval()
does. That’s because lastval()
doesn’t report on any particular sequence – it reports on the last time nextval()
was used in the current session, regardless of which sequence was used. The currval()
on the other hand, only reports on the specified sequence.