如何id分配外键mysqli [英] how can id assign foreign key mysqli

查看:84
本文介绍了如何id分配外键mysqli的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在2张桌子上创建了。这些表是Department,employee。

I have created at 2 tables. These tables are Department, employee.

现在我想在department表中分配外键,而 join 分配employee表。

Now i want to assign foreign key in department table and join with employee table.

有什么想法??

SELECT id,department FROM department; 
SELECT * FROM `employee'


推荐答案

create employee table field are- id(primary key),name,dept_id
department table fields are-dept_id(primary key),name


比选择部门表和dept_id.than点击保存按钮。

than select the department table and dept_id.than click save button.

这篇关于如何id分配外键mysqli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆