Gossamer Forum
Home : General : Databases and SQL :

help with SQL statement

Quote Reply
help with SQL statement
Given the following table, what's the SQL statement to find how many more units a student needs to take in each category?
(SSN is the student's ID #, MIN_UNITS is the minimum units required for the corresponding category.
The table COURSE shows all the courses the student has taken already)

COURSE

SSN COURSE# UNITS COURSE CATEGORY MIN_UNITS
134 11 4 art 30 elective 40
134 15 4 music 34 elective 24
134 25 2 art 55 general 24
134 17 4 art 35 elective 24

Last edited by:

Wil: May 26, 2003, 11:00 AM
Quote Reply
Re: [KJones] help with SQL statement In reply to
Your messages have moved to 'Databases and SQL' forum. Please post your questions to the right forum, so people will be able to help you.

TheStone.

B.
Quote Reply
Re: [KJones] help with SQL statement In reply to
One of your problems might be that that's a confusing table. If MIN_UNITS applies to the minimum units for a given CATEGORY, then how can row one have "elective 40" and the next have "elective 24"? Which MIN_UNITS is valid?

It seems like the first task is to normalize the tables a bit more. Or, I may just be confused by your question.