MySQL SHOW ERRORS

MySQL SHOW ERRORS

 MySQL SHOW ERRORS



Summary: in this tutorial, you will learn how to use the MySQL SHOW ERRORS statement to display error information generated by a query.

Introduction to MySQL SHOW ERRORS statement

The SHOW ERRORS is a diagnostic statement that displays information for errors.

The SHOW ERRORS is similar to the SHOW WARNINGS except that it shows only errors, not warnings and notes.

The following SHOW ERRORS displays all errors:

SHOW ERRORS;

To limit the number of errors to return, you use the SHOW ERRORS LIMIT statement:

SHOW ERRORS [LIMIT [offset,] row_count];

The LIMITLIMIT the clause has the same meaning as for the SELECT statement.

To get the total number of errors, you use the following form of the SHOW ERRORS statement:

SHOW COUNT(*) ERRORS;

Or you can select it from the system variable @@error_count:

SELECT @@error_count;

MySQL SHOW ERRORS statement example

This statement returns id from the products the table in the sample database:

SELECT id FROM products;

However, the products the table does not have the id column.

To show the error, you use the SHOW ERRORS statement:

SHOW ERRORS;

To get the total number of errors, you use the error_count variable:

SELECT @@error_count;

In this tutorial, you will have learned how to use the MySQL SHOW ERRORS statement to display error information.

Reactions

Post a Comment

0 Comments

close