Skip to content

MySQL Tutorial SQL Basics

Getting Help from MySQL

Lesson 26 of 308 2 min read By Deepak Paswan Updated Oct 5, 2026

You will never remember every statement. Good developers know where to look.

1. The built-in HELP command

The mysql client can show the syntax of any statement:

query.sql
SQL
HELP 'SELECT';
Output
OUTPUT
Name: 'SELECT'
Description:
Syntax:
SELECT
    [ALL | DISTINCT | DISTINCTROW ]
    ...

HELP contents shows a topic list. This works offline, but the descriptions can be short, and it needs the help tables to be loaded on the server.

2. Ask the server about itself

MySQL describes its own contents. This is more reliable than memory.

query.sql
SQL
CREATE TABLE books (id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(100) NOT NULL, price DECIMAL(6,2));
query.sql
SQL
SHOW CREATE TABLE books\G
Output
OUTPUT
*************************** 1. row ***************************
       Table: books
Create Table: CREATE TABLE `books` (
  `id` int NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `price` decimal(6,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
CommandShows
SHOW DATABASES;All databases you may see
SHOW TABLES;Tables of the current database
DESCRIBE books;Columns of a table
SHOW CREATE TABLE books;The exact statement that rebuilds the table
SHOW INDEX FROM books;Indexes
SHOW VARIABLES LIKE 'sql_mode';A server setting
SHOW STATUS LIKE 'Threads%';Server counters
query.sql
SQL
SELECT table_name, engine FROM information_schema.tables WHERE table_schema = 'learn';
Output
OUTPUT
+------------+--------+
| TABLE_NAME | ENGINE |
+------------+--------+
| books      | InnoDB |
+------------+--------+
1 row in set

INFORMATION_SCHEMA is a set of read-only views, in standard SQL, that describe databases, tables, columns and more. You can use ordinary SELECT on them.

3. The official reference manual

The MySQL Reference Manual at dev.mysql.com/doc is the final answer. Tips:

  • Choose your version at the top of the page (8.4, 9.x, or 8.0). The same statement can differ.
  • Search the statement name, for example INSERT statement.
  • Read the syntax box at the top, then the examples further down.
  • In the box, [ ] means optional, | means “one of”, and ... means “can repeat”.
  • Use the “What’s new” and “Differences from MariaDB” sections when you upgrade or switch servers.

4. Asking for help well

When you ask on a forum or a team chat, give:

  1. Your MySQL version (SELECT VERSION();).
  2. The table definition (SHOW CREATE TABLE).
  3. A few sample rows.
  4. The exact query, the result you get and the result you expect.
  5. The full error text, including the number.

A good question has a good answer within minutes. “It does not work” has none.

lightbulb
Build a small test table
When you are unsure how something behaves, create a tiny table in your learn database and try it. Two minutes of experiment beats ten minutes of guessing.