MAX() – Find the Maximum Value in a Column in MySQL

The MySQL MAX() function is an aggregate function that returns the maximum value from an expression.

Typically, the expression would be a range of values returned as separate rows in a column, and you can use this function to find the maximum value from the returned rows. If there are no matching rows, MAX() returns NULL.

For example, you can use this function to find out which city has the largest population out of a list of cities.

Continue reading

JSON_QUERY() vs JSON_VALUE() in SQL Server: What’s the Difference?

Two of the many T-SQL functions available in SQL Server are JSON_QUERY() and JSON_VALUE(). These functions can be used to extract data from JSON documents.

Their general syntax is similar, and at first glance, you might think they do exactly the same thing, but they don’t. There’s definitely a place for both functions when working with JSON and SQL Server.

This article looks at the difference between JSON_QUERY() and JSON_VALUE().

Continue reading

ORD() Examples – MySQL

In MySQL, the ORD() function returns the numeric value of the leftmost character of a given string. You provide the string as an argument.

If the leftmost character is a multibyte character, the returned value is calculated from the numeric values of its constituent bytes. If the leftmost character is not a multibyte character, the return value is its ASCII code (which is the same result as when using the ASCII() function).

Continue reading