MySQL 如何创建一个具有MyISAM引擎表的表

MySQL 如何创建一个具有MyISAM引擎表的表

要创建一个具有MyISAM引擎的MySQL表,我们可以使用ENGINE命令。首先,让我们使用CREATE命令创建一个表。

mysql> create table StudentRecordWithMyISAM
   -> (
   -> Id int,
   -> StudentName varchar(100),
   -> StudentAge int
   -> )ENGINE=MyISAM;
Query OK, 0 rows affected (0.26 sec)

以上,我们将引擎设置为“MyISAM”。

要检查表中有多少列,请使用DESC命令。

mysql> DESC StudentRecordWithMyISAM;

以下是输出内容。

+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| Id          | int(11)      | YES  |     | NULL    |       |
| StudentName | varchar(100) | YES  |     | NULL    |       |
| StudentAge  | int(11)      | YES  |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

要检查表是否有MyISAM,请输入以下命令:

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

以下是输出结果,清楚地显示引擎为MyISAM。

+-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| 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 |
+-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
| studentrecordwithmyisam | MyISAM |      10 | Dynamic    |    0 |              0 |           0 | 281474976710655 |         1024 |         0 |              1 | 2018-10-22 15:47:01 | 2018-10-22 15:47:02 | NULL       | utf8mb4_unicode_ci |     NULL |                |         |
+-------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+---------------------+------------+--------------------+----------+----------------+---------+
1 row in set (0.14 sec)

要检查MyISAM表是否存在,请使用以下命令。

mysql> SELECT TABLE_NAME,
   ->  ENGINE
   -> FROM information_schema.TABLES
   -> WHERE TABLE_SCHEMA = 'business' and ENGINE = 'MyISAM';

以下是输出结果。

+-------------------------+--------+
| TABLE_NAME              | ENGINE |
+-------------------------+--------+
| studentrecordwithmyisam | MyISAM |
+-------------------------+--------+
1 row in set (0.00 sec)

阅读更多:MySQL 教程

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程