Newbie SQL problems

From: Vemptzuu <temae.sporcaLEVAMI_at_libero.it>
Date: Thu, 27 Jun 2002 12:48:24 +0200
Message-ID: <ceqlhug75v9o757cihpb96kej65mjtg3ot_at_4ax.com>



Hi all, I am an Engineering student at the University of Pisa, Italy. We are currently studying some DB basics, and I am having some problems with SQL queries.

I have the following relation (It's more complex, i'll list only attributes i'll need now)

Exam_schema (student-name, result, exam-session)

ex-number: If the university organizes, let's say,

I have the query: "Find all students which have passed at least one exam in each exam session this year".

An exam is passed with a result of 18 or more (to a maximum of 30).

I tried to write down this:

SELECT student-name
FROM Exam
WHERE result >17
GROUP BY student-name
HAVING COUNT (DISTINCT exam-session) > *something to find the total sessions organized this year*

Is this correct?

It's part of a more complex query, but I have doubts on this, so I won't move on for now ;)

Thanks in advance
-- *Vemptzuu*
Sonic Adventure 2 emblems: 146/180

   /\ "In a realm beyond sight,
  /__\ The Sky shines gold, not blue.
 /\ /\ There, the Triforce's might
/__\/__\ Makes mortal dreams come true." Received on Thu Jun 27 2002 - 12:48:24 CEST

Original text of this message