navicat for mysql中使用模型?

登录进数据库后,点击模型--新建模型,如下

navicat <wbr>for <wbr>mysql中使用模型?



点击“小手”下面的图标----双击右边的空白处,即出现一个表格,可命名,此时我们命名为A
navicat <wbr>for <wbr>mysql中使用模型?


双击A表下空白处---即可设计A表属性,点确定。如下
navicat <wbr>for <wbr>mysql中使用模型?

navicat <wbr>for <wbr>mysql中使用模型?
同理,生成一个B表
navicat <wbr>for <wbr>mysql中使用模型?
如何让A、B表根据外键,获得联系呢?双击A表空白处,获得如下属性,点击外键,填写下面信息。名可以随便取,杠位为A表属性,要连接外部的。参考模式可以不填。域参考表选择要参考的表如B表,参考杠位是选择B表的属性,来与A表关联。此时在A表里建立外键,说明A是从表,B是主表。
navicat <wbr>for <wbr>mysql中使用模型?
当保存上面外键设置问题,就会发现A、B表之间有一根线关联起来了。
navicat <wbr>for <wbr>mysql中使用模型?
这时模型建立起来,保存模型,命名模型为AB。其会默认保存在MySQL里,其保存不会让你选择保存地点,只能默认保存在MySQL中。
navicat <wbr>for <wbr>mysql中使用模型?


如下图如何把模型导出来,AB模型界面中-----三条杠下拉单----工具-----导出SQL,将会弹出保存界面。

navicat <wbr>for <wbr>mysql中使用模型?



navicat <wbr>for <wbr>mysql中使用模型?
看,上面保存在桌面上,此时桌面会有一个AB.sql文件出来
navicat <wbr>for <wbr>mysql中使用模型?

比如你要用该模型,则登陆的表---选运行SQL文件----找到AB.sql文件出来运行即可得出结果。
navicat <wbr>for <wbr>mysql中使用模型?

原文地址:https://www.cnblogs.com/whowhere/p/navcat.html