student attendance table structure - mysql

my apologies for asking it very uncommon question.
I am using mysql and i have database which has the following tables
course
course_subject
subject
student
student_course
department
employee
employee_role
personal_information
attendance
attendance_symbol
the above database is linked to each other(relational database)... it is fine until when it comes to attendance... when a student enroll to a course it automatically enroll to the subjects that are related to that particular course..
but when it comes to attendance as whole i have some issues which.. but first lets let me tell you folks what i have assumed about attendance which may not be right but that includes:
1. when student enroll to a course it automatically enroll to its subjects
2. each course has their register students
3. student enroll on daily basis
I cant seems to work it out how cope with the situation... i just need help to create a table that will mark student attendance everyday... once marked dont know may be stored another table or how... need help
and student get it attendance everyday...
but when it comes to attendance i cant work it out where should i have attendance table... should i link attendance table to student_course or where?

To save the information of whether a Student attended to a Subject on a certain date, you should have a table like the following:
Attendance (student_id, subject_id, date)
And then store when the student attended. That way, it will be related to your Student, Subject, but also to student_course as the subject is part of the course. Or you can just store course_id instead of subject_id.

Related

Better way to design Attendance Managment Design

Good evenings. I trying to make simple Attendance Managment Sytem using MySQL. My goal is teacher can mark student attendance in given day and student can see his/her attendance. But i am having problem about design. First, let me explian my system.
Here is my plannig....
System has Student,Teacher and Courses.
A Teacher can teach multiple Course.
A Course can have multiple Teacher.
A Course dividen in Groups, for example 1 Course have group 1 and group 2 in different times.
A Teacher can teach Course in Multiple Groups but a Group can have only one teacher.
Student can have only one group in just one Course.
A Group can have multiple students.
A Group can occur in different time for example Group 1 has lecture in monday and tuesday.
Teacher can mark student attendance in his Course and Group
I have confusion in this system.First,i could not figure out where i should connect attendance table, because i wanted to student can see his attendance day by day so i connected to group_dates and as you can see attendance table have many attributes so it will be affect performance. Second one is should i connect student to course_groups alone or should i connect it both course_groups and courses like in the example?
I am very new to MySQL and design, if you can give advice i will be very appriciated

Need advice for designing university database

Introduction
Currently I'm designing a database structure for my university. I want to store student personal data and staff (non student) data. FYI, the total number of student's records is about 136K, incrementing about 10K each year. On the other hand, staff's records is only about 3K (slow incrementing).
Problem
I argued with my friend about three options below:
Create Person table, staff table and student table. The last two is inherited from Person table.
Create Person_staff table, staff table (inherit from person_staff). Then, same goes to student, create Person_student, and student table (inherited from Person_student).
Create Staff and Student table.
My opinion, option #1 is the best choice. But my friend argued that if we do that (option #1), we will have slow query when we need to retrieve only staff data, because had to join with Person table which is filled with student records (significantly larger than staff records).
Any advice for me? Thanks in advance.
EDIT: FYI, we need to be able to track each person (whether staff or student) who was once a student or staff.

How to design a simple database

I want to model a student, teacher, class relationship. Every student is associated with one teacher (the teacher can have many students). There are only three classes. The way I think of this is that there are three tables:
Student Table -> (student_id, student_name, class_id)
Teacher Table -> (student_id, student_name, class_id)
Class Table -> (class_id, class_name)
I'm not sure how to show the student-teacher relationship within the tables. How would we know which teacher is assigned to which student?
This can be accomplished with some simple joins.
Assuming that you want to find all the students associated with a certain teacher, you would start off by grabbing the row for the teacher. You would then join in the classes that the teacher teaches. Finally, you would join in the students that are in those classes.
This is known as a many-to-many relationship, and is an important concept in databases.
select
t.student_name, -- I suspect this col might actually be named teacher_name
s.student_name,
from
-- Find the classes that a teacher teaches
teacher_table t join class_table c on (t.class_id=c.class_id)
-- Find the students in those classes
join student_table s on (s.class_id=c.class_id)
where
t.student_id = ? -- Again, I suspect this should be "teacher_id"
This is a few more tables than you want, but several of the .NET examples that Microsoft has created revolve around a similar relational database.
Here is a link to that database:
https://msdn.microsoft.com/en-us/library/bb399731(v=vs.100).aspx
In this example, the student and the teacher are both kept in the person table and are related to the course table through two different Joining tables . . student grade and course instructor.
And here is the Contoso University Schema with link:
https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-a-more-complex-data-model-for-an-asp-net-mvc-application

Is there a query for this?

Im making a system for a school and I have this mySQL tables. The names are self explanatory:
student: id name course_id
course: id name
subject: id name
subject_course: id subject_id course_id
grade: id type grade
grade_type: id name
I need to check if every student of a certain course has a grade of type X on every subject that is related with that course.
Let's say grade_type = 'written test'. So I need to check if every student of 1st grade has a grade on the written test on EVERY subject related to first grade (example: math, spanish, history, etc). If yes, I do some stuff. If not, another.
Is there a query that can check that? I was thinking on check student by student but I think is less efficient.
This schema doesn't seem to make sense.
Why would course_id be field on student table? My guess is you need a student_course table to represent a many-to-many relationship between students and courses here.
Also, the grade_type table seems kind of trivial and extra overhead with little value. Could type not just be an enum on grade table?

What could be the right SQL query for this? I am using MS Access dbms

I have three tables names are Courses, EnrolledCourses and Student.
Courses table has fields namely coursenumber, coursedescription, courseunits, courseprerequisite, yearlevel (yearlevels of students who are supposed to take the course), and semester (semester in which a course is to be offered).
Students table has fields namely studID, studName, studStatus (or the year level), and studCourse.
EnrolledCourses table on the other hand has fields namely studID, courseNumber, remarks, and yearEnrolled.
QUESTION:
Suppose one of the courses or subjects taken by a student in the first semester is English101 but the student wasn't able to pass it. For this matter, English102 is to be offered for the second semester and English101 is its prerequisite course. What if i want to view all the courses for the second semester that this particular student should enroll EXCEPT the course for the second semester having a prerequisite courses that this student didn't pass. The remarks attribute from the EnrolledCourses table contains values as to whether course/prerequisite course is "Passed" or the otherwise.
I seriously need an answer to this question. If you really wanna help on this, email me at markydspark#gmail.com. THANKS!