php - Database Design for students marks per paper -
earlier i've asked question attendance system. in same system, i'm having separate table store students marks. now, before question show i've done far:
in every semester there 2 papers. there 6 semesters complete course. in first paper student can have maximum marks of 75 , second paper marks of 25. now, i've build simple table students_marks
follows:
name | type ------------|------- marks_id | int s_id | int sem_id | int sessionyear | varchar(11) paper_one | decimal(11,0) paper_two | decimal(11,0)
now, marks_id
primary key
, while s_id
, sem_id
foreign keys
2 other tables student_info
, semester
.
to output marks obtained this:
select * `student_marks` join `student_info` on student_marks.s_id = student_info.s_id student_info.deleted = ? , `sem_id` = ? , `sessionyear` = ? order `class_roll`
what didn't realize on 5th , 6th semester there 4 papers each paper maximum marks of 50. if add 2 more column above table redundant other semesters wont need have 4 papers.
i'm looking re-design table enable me incorporate new papers.
thanks in advance.
note: i'm using mysql database , php creating application.
i use more normalised form:
create table student (id int, -- pk 1 studentinfo ... )-- student info create table attendance (studentid int, -- fk student semesterid int) create table paper (studentid int, --fk student table selemsterid int, -- fk attendance table paperid int, -- 1 each paper paperdate date, -- allows retakes papermark decimal(11,0) ) -- store marks select s.*, p.* student s inner join attendance on a.studentid = s.id inner join paper p on p.studentid = s.id , p.semesterid = s.semesterid
Comments
Post a Comment