Question

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;
Was it helpful?

Solution

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;

OTHER TIPS

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top