Student grades query of two courses

Hi everybody
I need some advices from experts. I'm trying to make a suitable database for students grades. I'm a bit confused in how to gather all grades of each single student into one from. let say that the students have two courses, where each course has 4 tests. The
4 tests of the two courses are summed separately, so we will have two total grades. Finally, the average of the two grades is considered as the final grade. Here I would like inquire, should I create one query for all grades or it is better to create a query
for each course grades then create a third query to gather the two queries. Note that I need to print out the first course grade (including the tests ). Also, In the second course I will have to print out the whole grades in details for the two courses. 
Any help please.
Thanks in advance.

Amending the model for one of my online demos, StudentCouses.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
to include tests gives the following model:
With this the final grade per student can be returned with the following query:
SELECT StudentID, FirstName, LastName,
AVG(TotalGrades) AS FinalGrade
FROM
    (SELECT Students.StudentID, FirstName, LastName,CourseName,
     SUM(StudentCourseTests.Grade) AS TotalGrades
     FROM (Courses INNER JOIN Tests ON Courses.CourseID = Tests.CourseID)
     INNER JOIN (Students INNER JOIN StudentCourseTests
     ON Students.StudentID = StudentCourseTests.StudentID)
     ON (Tests.CourseID = StudentCourseTests.CourseID)
     AND (Tests.Test = StudentCourseTests.Test)
     GROUP BY Students.StudentID, FirstName, LastName,CourseName) AS sqTotalGrades
GROUP BY StudentID, FirstName, LastName;
It would be a simple task to create a report based on the tables and return the individual grades per student per test, along with the sums of grades per test in a group footer, and the final grades in a subreport based on the above query.
Ken Sheridan, Stafford, England
Ken Sheridan,
That is great. However, can I make a class table and then the link it to the student table as (one to many )?

Similar Messages

  • Problem querying over two fact tables

    The business requirement is that we want to be able to see sales for two different periods of times, over different brands, different Items' years and seasons per periods.
    So for the different dimensions I created alias having two tables in the physical layer
    for Brands, Shops and Items (tables) [These are the tables where I query for different brand, Item's year and different season]. The Business Model Schema looks like this:
    Items-----> SALES <------Brands Items 2-----> SALES 2 <------------Brands 2
    ^ ^
    TIMES TIMES 2 (TIMES JOINED WITH SALES AND TIMES 2 WITH SALES 2)
    and VENDORS connected to both SALES & SALES 2 left outer joined
    The need is that I need to query over two indepedent periods of time with independed dimensions but for a common dimension (Vendors).
    The presentation data simplified looks like this:
    Answers
    Vendor Sales Qty Sales 2 Qty
    1092 234 123
    The problem is that when a vendor doesn't exist in one period it doesn't come and in the other although there are sales. So when I query with the same filters (same period of time, Brands, Items' years and seasons) over these two fact tables I get the same sales and correct data. When there are different criteria then I lose data.
    The Query fired in the database is the following:
    select distinct case when D2.c4 is not null then D2.c4 when D1.c4 is not null then D1.c4 end as c1,
    D1.c3 as c4,
    D1.c1 as c5,
    D1.c2 as c6,
    cast(D1.c2 / nullif( D1.c1, 0) * 100 as DOUBLE PRECISION ) as c7,
    D2.c3 as c8,
    D2.c1 as c9,
    D2.c2 as c10,
    cast(D2.c2 / nullif( D2.c1, 0) * 100 as DOUBLE PRECISION ) as c11
    from
    (select sum(T43161.amnt_1) as c1,
    sum(T43161.mk_1) as c2,
    sum(T43161.qty_1) as c3,
    T7120.VE_NAME as c4
    from
    VE04_TBL T7120,
    GE04_COMPANY_TBL T43802,
    EI04_TBL T6931,
    Salesmcost T43161
    where ( T6931.EI_CODE = T43161.ei_code and T6931.VE_CODE = T7120.VE_CODE and T6931.GE_COMPANY_CODE = '1' and T6931.EI_SEASON_CODE = 'Χ' and T6931.EI_YEAR = '2009' and T7120.GE_COMPANY_CODE = '1' and T7120.VE_CODE = T43161.ve_code and T43161.ge_company_code = T43802.GE_COMPANY_CODE and T43802.GE_COMPANY_NAME = '*** Φ. & Κ. ΛΕΜΟΝΗΣ ΑΕΒΕ ****' and T43802.LIST_ITEM_IND = '1' and T43161.trans_date >= ADD_MONTHS(TO_DATE('2010-05-12' , 'YYYY-MM-DD'), -7 * 12 ) and T43161.trans_date between TO_DATE('2009-01-01' , 'YYYY-MM-DD') and TO_DATE('2009-01-31' , 'YYYY-MM-DD') )
    group by T7120.VE_NAME
    ) D1,
    (select sum(T44099.amnt_1) as c1,
    sum(T44099.mk_1) as c2,
    sum(T44099.qty_1) as c3,
    T7120.VE_NAME as c4
    from
    EI04_TBL T44615 /* EI04_TBL 2 */ ,
    VE04_TBL T7120,
    GE04_COMPANY_TBL T43802,
    Salesmcost T44099 /* Salesmcost_2 */
    where ( T7120.VE_CODE = T44099.ve_code and T7120.VE_CODE = T44615.VE_CODE and T7120.GE_COMPANY_CODE = '1' and T43802.GE_COMPANY_CODE = T44099.ge_company_code and T43802.GE_COMPANY_NAME = '*** Φ. & Κ. ΛΕΜΟΝΗΣ ΑΕΒΕ ****' and T43802.LIST_ITEM_IND = '1' and T44099.ei_code = T44615.EI_CODE and T44615.GE_COMPANY_CODE = '1' and T44615.EI_SEASON_CODE = 'Χ' and T44615.EI_YEAR = '2008' and T44099.trans_date between TO_DATE('2008-01-01' , 'YYYY-MM-DD') and TO_DATE('2008-01-31' , 'YYYY-MM-DD') )
    group by T7120.VE_NAME
    ) D2
    where ( D1.c4 = D2.c4 ) /*<------- I think that this join creates the problem*/
    order by c1
    Edited by: user1198434 on 12 Μαϊ 2010 5:14 πμ
    Edited by: user1198434 on 12 Μαϊ 2010 5:41 πμ

    Hi,
    go through this
    http://obiee101.blogspot.com/search/label/OUTER%20JOIN
    I think you are new to the forum. try searching through some of the famous obiee forums. Gurus have already covered most of the issues. few are,
    http://obiee101.blogspot.com
    http://oraclebizint.wordpress.com/
    http://gerardnico.com/weblog/
    http://108obiee.blogspot.com/
    thanks,
    karthick

  • Select query on two Database views

    Hi all,
    Can i fetch the data by writing a select query on two DATABASE VIEWS
    Because i am able to fetch data by writing a selct query on ONE DATABASE VIEW and ON TRANSPARANT TABLE
    but i am not able to fetch data by writing a query on TWO DATABASE VIEWS
    Query which i am able to fetch data is
    select * from CSKS where OBJNR = COVJ-OBJNR
    Query which i am NOT able to fetch data is
    Select * from COAS where OBJNR = COVJ-OBJNR
    Here
    COVJ is a DATABASE VIEW
    CSKS is a Transparant Table
    COAS is a DATABASE VIEW
    Thanks in advance
    Regards
    Ajay

    Hi
    I tried with code and I am able to fetch data from view COAS
    DATA:it_coas TYPE STANDARD TABLE OF coas.
    SELECT * FROM coas INTO TABLE it_coas.
    IF sy-subrc IS INITIAL.
      WRITE:/ 'Sucess'.
    ENDIF.
    I think in your case COAS view does not have a value for COVJ-OBJNR.
    Regards
    Srilaxmi

  • Select Query Between two dates...

    Hi Guru's,
    I need a Select Query between two dates, also if the record not found for any in between date then it should return NULL or 0 ...
    for Example
    1. I am having two records in DB for date 2-10-2008 & 4-10-2008
    2. Now suppose I have given Query for date between 1-10-2008 to 5-10-2008
    Then it should return me 5 records with valid values for 2 & 4 and NULL for other 1,3,5
    Thanks.

    Try like this:
    with
      t as
          select date '2008-10-02' as dt, 'Record #1 (in DB)' as str from dual union all
          select date '2008-10-04' as dt, 'Record #2 (in DB)' as str from dual
    select v.dt, t.str
      from (
             select date '2008-10-01' + level - 1 as dt
               from dual
             connect by level <= (date '2008-10-05' - date '2008-10-01') + 1
           ) v
      left join t
        on v.dt = t.dt
    order by 1

  • Can't  write right sql query by two tables

    Hello
    Everyone,
    I am trying to get a sql query by two tables,
    table:container
    <pre class="jive-pre">
    from_dest_id     number
    ship_from_desc     varchar
    to_dest_id     number
    </pre>
    table: label_fromat (changeless)
    <pre class="jive-pre">
    SORT_ORDER     number
    PREFIX     varchar2
    VARIABLE_NAME varchar2
    SUFFIX varchar2
    LF_COMMENT varchar2
    </pre>
    the sql which i need is
    a. table CONTAINER 's each column should have LABLE_FORMAT 's PREFIX before and SUFFIX back ,and these columns is connected
    example : the query output should be like this :
    <pre class="jive-pre">
    PREFIX||from_dest_id||SUFFIX ||PREFIX||ship_from_desc||SUFFIX ||PREFIX|| to_dest_id||SUFFIX
    </pre>
    every PREFIX and SUFFIX are come from LABEL_FORMAT's column VARIABLE_NAME (they are different)
    column SORT_ORDER decide the sequence, for the example above: Column from_dest_id order is 1, ship_from_desc is 2,to_dest_id is 3
    b. table LABEL_FORMAT's column VARIABLE_NAME have values ('from_dest_id','ship_from_desc','to_dest_id')
    If table CONTAINER only have one record i can do it myself,
    But actually it is more than one record,I do not know how to do
    May be this should be used PL/SQL,or a Function ,Cursor ,Procedure
    I am not good at these
    Any tips will be very helpful for me
    Thanks
    Saven

    Hi, Saven,
    Presenting data from multiple rows as a single string is called String Aggregation . This page:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    shows many ways to do it, suited to different requirements, and different versions of Oracle.
    In Oracle 10 (and up) you can do this:
    SELECT     REPLACE ( SYS_CONNECT_BY_PATH ( f.prefix || ' '
                                   || CASE  f.variable_name
                                        WHEN 'FROM_DEST_ID'
                                       THEN  from_dest_id
                                       WHEN 'SHIP_FROM_DESC'
                                       THEN  ship_from_desc
                                       WHEN 'TO_DEST_ID'
                                       THEN  to_dest_id
                                      END
                                   || ' '
                                   || f.suffix
                               , '~?'
              , '~?'
              )     AS output_txt
    FROM          container     c
    CROSS JOIN     label_format     f
    WHERE          CONNECT_BY_ISLEAF     = 1
    START WITH     f.sort_order     = 1
    CONNECT BY     f.sort_order     = PRIOR f.sort_order + 1
         AND     c.from_dest_id     = PRIOR c.from_dest_id
    saven wrote:If table CONTAINER only have one record i can do it myself,
    But actually it is more than one record,I do not know how to do In that case, why did you post an example that only has one row in container?
    The query above assumes
    something in container (I used from_dest_id in the example above) is unique,
    you don't mind having a space after prefix and before from_dest_id,
    you want one row of output for every row in container, and
    you can identify some string ('~?' in the example above) that never occurs in the concatenated data.

  • How to query for two tables

    Hi,
    I have this problem, How can query a two table?
    Table A ->  Table B
    id               table-a_id
    name          table_b_name
    the relationship is one-to-many
    How can I get the result?
    Hope my question make sense
    cheers.
    thanks a lot.

    I bet you have more luck looking for an answer in a SQL forum.

  • How to query in two tables

    Hi all
    How to query in two different tables? Should i use the following
    SET_BLOCK_PROPERTY('ins1', ONETIME_WHERE, 'serial = ''' || :GLOBAL.CODE || ''''); this is working but for one table if i want for both tables and and it display the related information in main form , eg..tables are referenced by primary key constraint and foreign key.
    sarah
    Edited by: SarahSarahSarah on Sep 1, 2009 4:59 AM

    For the primary forign key tables no need to create two forms use the master detail functionality of forms.
    create a Master/Detail form using the DEPARTMENT, EMPLOYEE tables.
    DEPARTMENTwill be the Master block and EMPLOYEE will be the Detail block. The join condition between the two tables is where the deptno column of DEPARTMENT is equal to the deptno column of EMPLOYEE .
    The following is an outline of the steps:
    Create the DEPARTMENT data block and include the all the fields on the form.
    Use the Form layout and only display one record at a time.
    Go back to the Object Navigator and select the "Data Blocks" tree. Make sure the DEPARTMENT block is not selected and run the Data Block Wizard again.
    Create the EMPLOYEE data block and include all of the columns.
    For the master/Detail relationship, de-select the "auto" option, use a Join relationship, choose the DEPARTMENT data block as the Master and set EMPLOYEE.DEPTNO= DEPARTMENT.DEPTNO for the join relationship.
    In the Layout Wizard for the Dependents data block, display all of the fields
    Choose a Tabular style and display 4 up to records at once with 0 space between each record.
    Save the form and run the form.
    Thanks

  • Query comparing two version

    Hi ,
    I have a small query comparing two vesions in java . my version like
    *1st one Version Name : swv-ora-tes-4.5*
    *2nd one Version Name :swv-ora-tes-4.6*
    How can we compare this version and 2nd one is latest version
    Regards
    Pattanaik

    Here's something you would have found by yourself in about 15 seconds if you'd bothered to do any work:
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#compareTo(java.lang.String)

  • Use student CC license on two computers simultaneously?

    Can I use my student CC license on two computers simultaneously without problem? I know I can install it on two computers, but I want to use them at the same time, at different locations.

    A single Creative Cloud membership can only be installed on to two machines only and you are also able to use both of them at the same time . Thats a special exception that we have provided to our Creative Cloud customers.
    I hope this should help .
    Creative Cloud on 2 personal computers
    Regards
    Rajshree

  • Can I put creative student edit cloud on two of my computers

    can i put creative student edit cloud on two of my computers

    Moving this discussion to creative cloud discussion from photoshop.com storage and sharing.

  • Does the Student License Allow for Two Installs?

    Does the Student License Allow for Two Installs?
    I have a desktop iMac and a Macbook notebook. I just purchased Adobe Web Standard CS3 (student license).
    Can I install and activate the package on both of my computers? I know I could do this with a regular license, but I was unsure about the student license.
    Thanks in advance.
    Dave

    HEEEEEELPPPPPPPPPP, PLEASE
    I purchased adobe cs3 primium but i already had photoshop installed. I installed cs3 primium and now i keep getting the error that the licensing has stopped working can't use file cont IT or cust. support. I tried to download the clean file and it gives me the same error to open this file. i tried to uninstall with control panel programs and uninstall and it gives me the error uninstall not complete. I tried to repair with disc and uninstall with the disc and nothing is working. I have windows vista with 100g hd 500 mem duo core all the proper requirements but i can't get this to work.'
    HELP anyone

  • Query between two date columns ?

    Oracle 11g R2
    I'm trying too create a query between two date columns. I have a view that consists of many columns. There are two columns in question called valid_to and valid_from
    Part Number     Valid_from        valid_to
    100                    01/01/2000       01/01/9999
    200                    01/01/2000       01/01/9999
    300                    01/01/2000       01/01/9999
    etc
    If I want to only see rows between with a date range of 01/01/2000 and 01/01/2013 how can I put this as SQL ?
    Thanks in advance

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    See the forum FAQ: https://forums.oracle.com/message/9362002
    If you want to find rows that have that exact range, then you can do  something like
    SELECT  *
    FROM    table_x
    WHERE   valid_from  = DATE '2000-01-01
    AND     valid_to    = DATE '2013-01-01'
    If you want to find rows where any or all or the range on the row overlaps any or all of the 200-2013 target range, then
    SELECT  *
    FROM    table_x
    WHERE   valid_from  <= DATE '2013-01-02
    AND     valid_to    >= DATE '2000-01-01'
    If you want rows that are enritely within the target range, it's something else.
    If you want rows that entirely enclose the target range, it's something else again.

  • I wish to purchase creative cloud for students, now i have two computers that i use actively, can i use cloud on both at the same price and download?

    I wish to purchase creative cloud for students, now i have two computers that i use actively, can i use cloud on both at the same price and download?

    Your subscription allows for you to install on two machines.  One condition is that only one of the installations can be in use at any given time.

  • I'm using numbers for my students grades. the passing grade is 30 points. what i want to happen is that very students with a grade of less than 30 will have their points it red color. does the IF function can do this? how?

    i'm using numbers for my students grades. the passing grade is 30 points. what i want to happen is that very students with a grade of less than 30 will have their points it red color. does the IF function can do this? how?

    Hi efren
    Conditional format will do this.
    Select the Cells, then Menu > Format > Show Conditional Format Rules
    Regards,
    Ian.

  • Handling Arrays with Students Grades

    Can anyone help!
    I am traying to compile program Grade2 which processes student assignment marks to determine how many students obtained each of possible grades: 1 to 5. The user enters each grade as an integer and to mark the end of the data stream a 0 or negative number. One should use suitable array to hold the numbers of students with each grade.
    This is what I compiled so far:
    import java.io.*;
    class Grade2
         public static void main(String[]args)
         throws IOException
              int grade2, count[];
         System.out.println ("Input a grade");
              grade2=Course_io.readInt();
              for (int i=0; i<5; i++)
              while (grade2>0)
                   if (grade2==1)
                        count[0]=1;
                   else if (grade2==2)
                        count[1]=2;
                   else if (grade2==3)
                        count[2]=3;
                   else if (grade2==4)
                        count[3]=4;
                   else if (grade2==5)
                        count[4]=5;
                   else if (grade2>5)
                        System.out.println("Enter correct grade");
         System.out.println ("Input a grade");
                   grade2=Course_io.readInt();
         System.out.println("The result is "+count[0]);
         System.out.println("The result is "+count[1]);
         System.out.println("The result is "+count[2]);
         System.out.println("The result is "+count[3]);
         System.out.println("The result is "+count[4]);
    When compiling this program shows two errors: refering to: grade2=Course__io.read.Int();
    I do not know where I am doing wrong?
    emni

    Dear Joni Salonen,
    Thank you for last reply, it was a error of capital letter G for grades2, as you rightly noted. Now it complies fine but still does not do the task, eg I am supose to count a number of students with each grade and store them in the array, this rutine only notes array elements index for grade entered not a number of students with that grade. Please refer back to the original code and advise what to do to reflect this task. This is a repeat of the code:
    import java.io.*;
    class grade2
         public static void main(String[]args)
         throws IOException
              int grade2, count[];
              System.out.println ("Input a grade");
              grade2=Course_io.readInt();
              count = new int[5];
              for (int i=0; i<5; i++)
              while (grade2>0)
                   if (grade2==1)
                        count[0]=1;
                   else if (grade2==2)
                        count[1]=2;
                   else if (grade2==3)
                        count[2]=3;
                   else if (grade2==4)
                        count[3]=4;
                   else if (grade2==5)
                        count[4]=5;
                   else if (grade2>5)
                        System.out.println("Enter correct grade");
                   System.out.println ("Input a grade");
                   grade2=Course_io.readInt();
              System.out.println("Number of Grades no 1 is "+count[0]);
              System.out.println("Number of Grades no 2 is "+count[1]);
              System.out.println("Number of Grades no 3 is "+count[2]);
              System.out.println("Number of Grades no 4 is "+count[3]);
              System.out.println("Number of Grades no 5 is "+count[4]);
    Thanks!
    emni

Maybe you are looking for