Hi all, using these tables, Im trying to write a query that will list the students that have taken any type of class (class_level) and how many of that particular type they have taken so using a count of somekind.


PK FK Rank_Num      integer     refers to RANK
PK FK Stu_Num       integer     refers to STUDENT
     Rank_Date      date        

PK  Rank_Num        integer
    Rank_Name       string
    Rank_Belt       string

PK  Req_Num     integer
FK  Rank_Num        integer     refers to RANK
    Reg_Descript        string      

PK  Stu_Num     integer
    Stu_FName       string
    Stu_LName       string
    Stu_Initial     char
    Stu_DOB     date
    Stu_Join_Date       date    

PK FK   Meet_Num        integer     refers to MEETING
PK FK   Stu_Num     integer     refers to STUDENT
    Attend_Role     string

PK  Meet_Num        integer 
FK  Class_ID        integer     refers to CLASS
NN  Meet_Instruct       integer     refers to INSTRUCTOR (to account for every meeting needs an assigned instructor)
    Meet_Date       date

PK FK   Stu_Num     integer     refers to STUDENT
    Inst_Hire_Date  date
    Inst_Status     string      (compensated or volunteer)

PK  Class_ID        integer
    Class_Weekday   string  
    Class_Time      time
    Class_Location  string
    Class_Level     string

any ideas on how to write this? thanks

Hard to say from just your tables. Start of easy with one table, and extend your query with a join one table at a time.

I may be missing something here, but souldn't there be a row in STUDENT for classes taken and some sort of relationship between tables?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.