使用连接和哪里? MySQL的

时间:2022-09-16 14:30:06

Here's the question I have been given:

这是我给出的问题:

Fetch the delegate no & name along with the module code & name for delegates who have taken a module but have a failing grade.

获取代理号和名称以及已取得模块但成绩不合格的代表的模块代码和名称。

My tables are, module, delegates, session, take, course.

我的表是,模块,代表,会话,采取,课程。

table columns

delegate(name,number) 
Take( grade,number, Course) 
module(code,Name,cost,credits)

This is what I have so far:

这是我到目前为止:

SELECT delegate.no,
       delegate.name, 
       module.code,
       module.name AS Course
FROM delegate 
INNER JOIN module,take
WHERE grade  <40;

2 个解决方案

#1


0  

Try this...

SELECT delegate.name,
       module.code, 
       module.name,
       delegate.no 
FROM module 
INNER JOIN take 
ON module.code = take.code 
INNER JOIN delegate 
ON delegate.no = take.no 
WHERE grade<40;

#2


0  

SELECT delegate.no,
   delegate.name, 
   module.code,
   module.name
FROM delegate
INNER JOIN module ON delegate.name = module.name
INNER JOIN take ON module.name = take.Course
WHERE take.grade  < 40;

#1


0  

Try this...

SELECT delegate.name,
       module.code, 
       module.name,
       delegate.no 
FROM module 
INNER JOIN take 
ON module.code = take.code 
INNER JOIN delegate 
ON delegate.no = take.no 
WHERE grade<40;

#2


0  

SELECT delegate.no,
   delegate.name, 
   module.code,
   module.name
FROM delegate
INNER JOIN module ON delegate.name = module.name
INNER JOIN take ON module.name = take.Course
WHERE take.grade  < 40;