devxlogo

MySQL

Understanding sql_mode in MySQL

In MySQL, the sql_mode can have values set, so that the behaviour of the SQL being executed henceforth behaves as per the mode set. Considering the following use case where

Understanding MAX_USER_CONNECTIONS in MySQL

At times, you may want to restrict the number of connections made from a user to the database. This may be necessary to improve performance, reporting, etc. MySQL supports this

Using CAST for Explicit Conversion in MySQL

MySQL allows you to explicitly convert a number to a string with the help of CAST function. The example below illustrates how to use it. SELECT 55.5 AS NUMBER, CAST(55.5

Using JSON as a Data Type

MySQL is a very robust database that supports JSON as a data type. This will be very useful for applications that need the JSON data type for certain types of

Types of Engines that Are Supported in MySQL

MySQL supports multiple types of storage engines. There are specific engines that are meant for specific needs. Understanding of these storage engines is beyond the scope of the current discussion.

Finding the TAN of a Given Number

MySQL provides numerous mathematical calculations that can be computed with inbuilt functions. In order to find the TAN of a number, we can use the following: Query: SELECT TAN(400); Sample

Using the SUBSTRING_INDEX in MySQL

The SUBSTRING_INDEX helps in extracting a part of the given string from the beginning to the match in the index. Query: SELECT SUBSTRING_INDEX(‘MySQL Database’, ‘a’, 2) AS SUBSTRING_INDEX; Here, the

Locking a User Account in MySQL

After a user has been created and is currently in use, a need might arise for the user account to be locked. MySQL provides a mechanism to alter the user