Click here to Skip to main content
15,848,407 members
Home / Discussions / Database
   

Database

 
AnswerRe: NDF File Pin
Richard Deeming24-Mar-15 10:18
mveRichard Deeming24-Mar-15 10:18 
QuestionHelp needed on string function Pin
Ambertje24-Mar-15 7:01
Ambertje24-Mar-15 7:01 
AnswerRe: Help needed on string function Pin
Kornfeld Eliyahu Peter24-Mar-15 8:42
professionalKornfeld Eliyahu Peter24-Mar-15 8:42 
GeneralRe: Help needed on string function Pin
Ambertje25-Mar-15 0:43
Ambertje25-Mar-15 0:43 
GeneralRe: Help needed on string function Pin
Johan Hakkesteegt8-Apr-15 3:36
Johan Hakkesteegt8-Apr-15 3:36 
QuestionVB.NET MYSQL DATATABLE Pin
Pauls Pauls21-Mar-15 5:33
Pauls Pauls21-Mar-15 5:33 
AnswerRe: VB.NET MYSQL DATATABLE Pin
Peter Leow21-Mar-15 5:56
professionalPeter Leow21-Mar-15 5:56 
AnswerRe: VB.NET MYSQL DATATABLE Pin
manchanx21-Mar-15 6:14
professionalmanchanx21-Mar-15 6:14 
Unless you have omitted in your post something from your database-model, my first suggestion would be to rework your database-model a bit. You're missing some stuff there which would make a lot of sense:
Table ExamType
    ExamTypeId           (Primary Key)
    ExamTypeName         (Exam I / Exam II / Exam III)
 
Table Subject
    SubjectId            (Primary Key)
    SubjectName          (English / Geography / ...)

Table Student
    StudentId            (Primary Key)
    StudentName

Table Exam
    ExamId               (Primary Key)
    ExamTypeId           (Foreign Key referencing ExamType.ExamTypeId)
    SubjectId            (Foreign Key referencing Subject.SubjectId)
    ExamTakenDate

Table Mark
    ExamId               (Foreign Key referencing Exam.ExamId)       \_ Primary Key
    StudentId            (Foreign Key referencing Student.StudentId) /
    Score

Then you can get the marks with a query like this:
SQL
SELECT St.StudentName,
       Sj.SubjectName,
       Et.ExamTypeName,
       Ex.ExamTakenDate,
       Mk.Score
FROM Student AS St
JOIN Mark AS Mk ON St.StudentId = Mk.StudentId
JOIN Exam AS Ex ON Mk.ExamId = Ex.ExamId
JOIN ExamType AS Et ON Ex.ExamTypeId = Et.ExamTypeId
JOIN Subject AS Sj ON Ex.SubjectId = Sj.SubjectId
WHERE
     StudentId = ...   /* however you want to narrow your query result */
     ExamId = ...
     SubjectId = ...


Edit: What you can read when following the link Peter Loew has posted in his answer is basically the reasoning for my suggested rework of your database-model.
Recursion: see Recursion.


modified 21-Mar-15 11:42am.

GeneralRe: VB.NET MYSQL DATATABLE Pin
Pauls Pauls21-Mar-15 7:16
Pauls Pauls21-Mar-15 7:16 
QuestionOracle, inner join and substr function Pin
Ludwing RS20-Mar-15 10:29
Ludwing RS20-Mar-15 10:29 
AnswerRe: Oracle, inner join and substr function Pin
Eddy Vluggen20-Mar-15 11:21
professionalEddy Vluggen20-Mar-15 11:21 
AnswerRe: Oracle, inner join and substr function Pin
Jörgen Andersson20-Mar-15 14:20
professionalJörgen Andersson20-Mar-15 14:20 
GeneralRe: Oracle, inner join and substr function Pin
Ludwing RS23-Mar-15 9:02
Ludwing RS23-Mar-15 9:02 
QuestionSSRS merging main header of two columns into one and then splitting subheadings Pin
indian14316-Mar-15 13:39
indian14316-Mar-15 13:39 
QuestionSSRS Report not allowing to edit name of the field Pin
indian14316-Mar-15 12:44
indian14316-Mar-15 12:44 
AnswerRe: SSRS Report not allowing to edit name of the field Pin
Richard Deeming17-Mar-15 4:42
mveRichard Deeming17-Mar-15 4:42 
GeneralRe: SSRS Report not allowing to edit name of the field Pin
indian14318-Mar-15 13:46
indian14318-Mar-15 13:46 
QuestionHelp with SSAS project Pin
rafael.avaria16-Mar-15 8:10
rafael.avaria16-Mar-15 8:10 
QuestionProblem executing backup script in Sql Server 2012 Pin
delgaillo12-Mar-15 7:38
delgaillo12-Mar-15 7:38 
AnswerRe: Problem executing backup script in Sql Server 2012 Pin
Mycroft Holmes12-Mar-15 15:51
professionalMycroft Holmes12-Mar-15 15:51 
GeneralRe: Problem executing backup script in Sql Server 2012 Pin
delgaillo12-Mar-15 23:12
delgaillo12-Mar-15 23:12 
GeneralRe: Problem executing backup script in Sql Server 2012 Pin
Mycroft Holmes12-Mar-15 23:14
professionalMycroft Holmes12-Mar-15 23:14 
GeneralRe: Problem executing backup script in Sql Server 2012 Pin
delgaillo28-Sep-15 1:17
delgaillo28-Sep-15 1:17 
QuestionCreating SQL statements in Access Databases Pin
Member 115083508-Mar-15 15:25
Member 115083508-Mar-15 15:25 
AnswerRe: Creating SQL statements in Access Databases Pin
Richard Andrew x648-Mar-15 16:33
professionalRichard Andrew x648-Mar-15 16:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.