English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

How to create a MySQL table using an InnoDB engine table?

To create a table using the InnoDB engine, we can use the ENGINE command. This is the query to create the table.

mysql> create table EmployeeRecords
- > (
- > EmpId int,
- > EmpName varchar(100),
- > EmpAge int,
- > EmpSalary float
- > (ENGINE=INNODB;

We have set the ENGINE to INNODB above.

Use the DESC command to check the complete description of the table.

mysql> DESC EmployeeRecords;

This is the output.

+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| EmpId | int(11) | YES | | NULL | | |
| EmpName | varchar(100) | YES | | NULL | | |
| EmpAge | int(11) | YES | | NULL | | |
| EmpSalary | float | YES | | NULL | | |
+-----------+--------------+------+-----+---------+-------+
4 rows in set (0.05 sec)

Check if the table is created using InnoDB.

mysql> SHOW TABLE STATUS FROM business LIKE 'EmployeeRecords';

This is the output-

+-----------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+-----------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
| employeerecords | InnoDB | 10 | Dynamic | 0 | 0 | 16384 | 0 | 0 | 0 | NULL | 2018-10-22 15:22:01 | NULL | NULL | utf8mb4_unicode_ci | NULL | | |
+-----------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+
1 row in set (0.10 sec)

In the above output, 'Engine' is displayed as 'InnoDB'.