SQLyog中如何创建数据表副本?

说白了,在SQLyog中创建数据表的副本其实非常简单。
我们先来说说最重要的事情。
You need to connect to the target MySQL database, and then find the table you want to copy in the left database navigation bar, such as the Student table.我们去年跑的项目,数据量在3 000条左右,复制表结构只需要几秒钟的时间。
Another point, you need to select "Copy table structure/data" in "More table operations" in the right-click menu, and then configure the new table name, such as student_copy.这是一个关键细节。
如果勾选“结构和数据”,SQLyog将复制表的结构和数据,否则仅复制结构。
I initially thought that copying the table structure was enough, but later I discovered that if the data was not checked, the new table would have no data.等等,还有一件事。
如果表名已经存在,则必须更改名称以避免冲突。
很多人不重视这一点。
最后点击“复制”按钮,耐心等待操作完成。
界面将显示“表复制成功”提示。
The replicated table will inherit the original table's indexes and constraints by default, but foreign key associations will need to be processed manually.很多人都忽略了这个事情。
我认为值得一试,尤其是当您需要备份数据或设置测试环境时。

创建一个名为stu_insert的触发器,当向学生表student中插入记录时,自动更新班级表class中的学生人数numbe

直接使用 SQLYog 创建 MySQL 触发器。

触发器位于左侧菜单的“触发器”下。
右键单击创建或按 F4 打开窗口。
为触发器命名并单击“确定”。
该命令是在 bio1 上插入后执行的。
例如,当插入biao1 时,数据也被插入到页面中。
在每行开始后编写 SQL。

插入biao1 的SQL为INSERT into biao1 (name1 ,age) VALUES('新添加的姓名',1 1 1 )。
按 F9 插入数据。

不确定,但这就是经验。
你自己掂量一下吧。