mysql 创建表 引擎_如何使用InnoDB引擎表创建MySQL表?

要使用InnoDB引擎创建表,我们可以使用ENGINE命令。这是创建表的查询。mysql> create table EmployeeRecords

- > (

- > EmpId int,

- > EmpName varchar(100),

- > EmpAge int,

- > EmpSalary float

- > )ENGINE=INNODB;

上面我们已将ENGINE设置为INNODB。

使用DESC命令检查有关表的完整描述。mysql> DESC EmployeeRecords;

以下是输出。+-----------+--------------+------+-----+---------+-------+

| 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)

检查表是否用InnoDB创建。mysql> SHOW TABLE STATUS FROM business LIKE 'EmployeeRecords';

这是输出-+-----------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+----------------+---------+

| 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)

在上面的输出中,“ Engine”显示为“ InnoDB”。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值