devxlogo

MySQL

Adding a New Column in a Specific Position

Consider the following table that already exists: CREATE TABLE ‘NUMBERS_TABLE’ (‘ONE’ INT(11) NULL DEFAULT NULL,’THREE’ INT(11) NULL DEFAULT NULL,’FIVE’ INT(11) NULL DEFAULT NULL)COLLATE=’utf8_bin’ENGINE=InnoDB; And we want to add a new

Get Detailed Information on Tables in MySQL

MySQL provides a schema named information_schema. This has a table named TABLES that has detailed information on the available tables, their record count, etc. The query below helps you with

Understanding the INSTR Function

MySQL is very powerful with a lot of in-built features. Today we are analyzing the INSTR function. Syntax: INSTR (String, subString) Result: Returns the first index of the subString in

Trimming Decimal Places Using TRUNCATE

Use cases where we need to have the result with varying decimal places are possible. You can change the value in the resulting field using the TRUNCATE function. Consider the

Using MySqlCheck

MySQL provides many utilities for verifying and taking corrective actions in case of failures. One such tool is mysqlcheck Usage: [root@mypc]# mysqlcheck -h -u -p –analyze –databases ; The above