使用MySQL连接三个表我有三张桌子**Student Table**-------------id name-------------1 ali2 ahmed3 john4 king**Course Table**-------------id name-------------1 physic2 maths3 computer4 chemistry**Bridge**-------------sid cid-------------1 11 21 31 42 12 23 33 44 14 2现在用他学过的课程名称来显示学生的名字,**Result**---------------------------Student Course---------------------------ahmed physicahmed mathsahmed computerahmed chemistryali physicali mathsjohn computerjohn chemistryking physicking maths我构建以下查询select s.name as Student, c.name as Course from student s, course c join bridge b on c.id = b.cid order by s.name但它不返回所需的结果.。如果我想找出谁是经理而不是其他人,那么规范化的表格应该是什么呢?**employee**-------------------id name-------------------1 ali2 king3 mak4 sam5 jon**manage**--------------mid eid--------------1 21 33 44 5想要得到这样的结果:**result**--------------------Manager Staff--------------------ali kingali makmak samsam jon
3 回答
白衣非少年
TA贡献1155条经验 获得超0个赞
select s.name "Student", c.name "Course"from student s, bridge b, course cwhere b.sid = s.sid and b.cid = c.cid
添加回答
举报
0/150
提交
取消