为什么MGR需要用主键

为什么MGR需要使用主键?针对这个问题,今天小编总结这篇有关MGR表的文章,希望能帮助更多想解决这个问题的朋友找到更加简单易行的办法。

验证MGR架构表需要使用主键,不然插入数据会报错。

mysql> show tables;

+--------------+

| Tables_in_dd | +--------------+ | a            | +--------------+ 1 row in set (0.00 sec) MysqL> desc a; +-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | id    | int(11) | YES  |     | NULL    |       | +-------+---------+------+-----+---------+-------+ 1 row in set (0.00 sec) MysqL> insert into a values(1); ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin. MysqL> alter table a add primary key (id); Query OK, 0 rows affected (0.02 sec) Records: 0  Duplicates: 0  Warnings: 0 MysqL> desc a; +-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | id    | int(11) | NO   | PRI | NULL    |       | +-------+---------+------+-----+---------+-------+ 1 row in set (0.01 sec) MysqL> insert into a values(1); Query OK, 1 row affected (0.00 sec) MysqL> insert into a values(1); Query OK, 1 row affected (0.00 sec) MysqL> select * from a; +----+ | id | +----+ |  1 | +----+ 1 row in set (0.00 sec)

看完上述内容,你们对MGR架构表需要使用主键的原因大概了解了吗?如果想了解更多相关文章内容,欢迎关注编程之家行业资讯频道,感谢各位的阅读!

相关文章

这篇文章主要介绍“hive和mysql的区别是什么”,在日常操作中...
这篇“MySQL数据库如何改名”文章的知识点大部分人都不太理解...
这篇文章主要介绍“mysql版本查询命令是什么”的相关知识,小...
本篇内容介绍了“mysql怎么修改字段的内容”的有关知识,在实...
这篇文章主要讲解了“mysql怎么删除unique约束”,文中的讲解...
今天小编给大家分享一下mysql怎么查询不为空的字段的相关知识...