views:

112

answers:

0

Hi

What I want is selecting the univirsities where student satisfy major high school type ,min gpa, min general tests scores (Qiyas and Tahsiely) and some other subjects (courses) scores.

here is the database(SQLSERVER) http://sites.google.com/site/famu79/db.zip

I tried this SQL Code

SELECT  DISTINCT
        univirsities.uni_id
       ,univirsities.uni_name
FROM    univirsities
       ,students
WHERE   ( univirsities.uni_id IN (
          SELECT  UnivsTDepts.uni_id
          FROM    UnivsTDepts
          WHERE   UnivsTDepts.thanawiDeptsID = ( SELECT stu_major
                                                 FROM   students
                                                 WHERE  students.stun_id = 1054545454
                                                        AND UnivsTDepts.major_id = 17
                                               ) ) )
        AND ( students.stu_gpa >= ( SELECT  uni_majors.min_gpa
                                    FROM    uni_majors
                                    WHERE   uni_majors.uni_id = univirsities.uni_id
                                            AND uni_majors.major_id = 17
                                            AND students.stun_id = 1054545454
                                  ) )    

My Question is:

Am I on the correct way for getting what I want and How to check for major courses requirements which is stored in major_requirements table?