In MySQL, we can use the sys.version_major() function to return the major release version of the MySQL server.
what is
Understanding the PS_CURRENT_THREAD_ID() Function in MySQL
In MySQL, we can use the PS_CURRENT_THREAD_ID() function to get the Performance Schema thread ID assigned to the current connection.
The PS_CURRENT_THREAD_ID() function was added in MySQL 8.0.16, and it does the same thing as PS_THREAD_ID(CONNECTION_ID()).
Understanding the FORMAT_PICO_TIME() Function in MySQL
In MySQL, format_pico_time() is a Performance Schema function that converts a numeric Performance Schema latency or wait time in picoseconds into a human-readable format. It returns a string consisting of a value and a units indicator.
MySQL DEFAULT() Function Explained
In MySQL, the DEFAULT() function returns the default value for a given column in the database.
If the column doesn’t have a default value, an error is returned.
How AUTO_INCREMENT Works in MySQL
In MySQL, we can include the AUTO_INCREMENT attribute within a column definition in order to create an auto-incrementing column.
Generally, when we do this MySQL will automatically generate a value for us whenever we insert a new row into the table. I say “generally” because we can still explicitly insert our own value if that’s required.
MySQL IGNORE Clause Explained
In MySQL, we can use the IGNORE clause in statements that change data in order to ignore certain errors that might occur had we not used it. When IGNORE is used, such errors are downgraded to warnings.
For example, we can use IGNORE in an INSERT statement to ignore any errors we might normally get if we tried to insert a NULL value into a NOT NULL column. In such a case, MySQL won’t return an error. Instead, it will deal with the issue in another way, and provide us with a warning.
If we have strict mode enabled, we can use IGNORE to force MySQL to act as though strict mode is disabled. However, IGNORE can also be used to downgrade certain errors regardless of the strict mode setting.
MySQL GROUPING() Function Explained
In MySQL, the GROUPING() function allows us to identity which rows have been generated by the WITH ROLLUP modifier of the GROUP BY clause.
By default, WITH ROLLUP outputs NULL as the value that represents all aggregate values. By this, I mean it doesn’t provide us with a nice easy to read label. It simply outputs NULL. This makes it more difficult for us to distinguish between normal rows and super aggregate rows that were generated by WITH ROLLUP.
Overview of the LIST_ADD() Function in MySQL
In MySQL, list_add() is a system function that adds a value to a comma-separated list of values and returns the result.
So it’s a handy function that allows us to append a value to a list.
Overview of the LIST_DROP() Function in MySQL
In MySQL, list_drop() is a system function that removes a value from a comma-separated list of values and returns the result.
MySQL ANY_VALUE() Function Explained
In MySQL, ANY_VALUE() is an aggregate function that allows us to include nonaggregated columns in the SELECT list when using the GROUP BY clause.
The ANY_VALUE() function is commonly used to resolve issues that arise when a query includes columns that are not part of the GROUP BY clause or aggregate functions. It can be useful in scenarios where we want to include descriptive columns in a grouped result set without affecting the grouping behaviour.