Dealing with a curriculum database - mysql

Okay, I have 3 tables:
Students
Offered_subjects
Enrollees_list
Students will contain all the information of the students of the school
Offered_subjects will contain all the subjects offered by the school
Enrollees_list will contain all information about what subject a students is enrolled in and will also contain remarks for that subject (pass or fail).
Now, the subjects in offered_subjects contain courses that have prerequisites (ie. before qualifying for MySQL101, the student mas have a passing remark in DBMS101)
The categories of prerequisites are:
Academic Year
Semester
Subject
Note that not all the subjects listed in offered_subjects have all the categories for its prerequisite. Some require to finish a certain subject, some require that the student must be in a certain academic year (ie, 3rd year), and some have all three.
What's required for the program is to display all the students that are qualified for a selected subject.
Let's say: MySQL101 has prerequisite of 2nd year, 2nd sem, DBMS101
I need to list all the students that are on their 2nd year, 2nd sem, and have a passing remark in DBMS101.
This would be easy if all the subjects have same categories for its prerequisites where I can put the same queries in the where clause, but my problem is that, again, not all the subjects listed in offered_subjects have all the categories for its prerequisite.
I'm new to MySQL and it's kind of confusing to me at the moment.
How do I do it?

I'm guessing you have the following columns on the Offered_subjects table:
Req_year
Req_semester
Req_subject
If one of your subjects don't have values on this column, you can ignore this check for this column. Something like:
Select ... where (Subject.req_year is null OR Student.year >= Subject.req_year) ...
This way, required year will not be taken into account if it's null.
(note: I'm not completely sure of syntax right now, but that's the idea).

Related

mySQL: how to go along 3 different tables, referring to different column in each table but using primary keys

I'm trying to find out which schools had students that did not complete their exams in 2018. So I've got 3 tables set up being: ExamInfo, ExamEntry and Students. I'm going to try use the ExamInfo table to get information from the Students table though, I obviously only want the student information that did not complete their exam in 2018. Note: I'm looking for students that attended, though did not complete the exam, with this particular exam you can look at completed exam as passed exam.
Within ExamInfo I have the columns:
ExamInfo_Date --when exam took place, using to get year() condition
ExamInfo_ExamNo --unique student exam ID used to connect with other tables
ExamInfo_Completed --1 if completed, 0 if not.
...
Within ExamEntry I have the related columns:
ExamEntry_ExamNo --connected to ExamInfo table
ExamEntry_StudentId --unique studentId used to connect to Students table
ExamEntry_Date -- this is same as ExamInfo_Date if any relevance.
...
Within Students I have following columns:
Students_Id --this is related to ExamEntry_StudentId, PRIMARY KEY
Students_School --this is the school of which I wish to be my output.
...
I want my output to simply be a list of all schools that had students that did not complete their exams in 2018. Though my issue is with getting from the ExamInfo table, to finding the schools of which students did not complete their exam.
So far I've:
SELECT a.Students_School, YEAR(l.ExamInfo_Date), l.ExamInfo_Completed
FROM ExamInfo l ??JOIN?? Students a
WHERE YEAR(l.ExamInfo_Date) = 2018
AND l.ExamInfo_Completed = 0
;
I'm not even sure if going through the ExamEntry table is necessary. I'm sure I'm meant to use a join, though unsure of how to appropriately use it. Also, with my 3 different SELECT columns, I only wish for Students_School column to be output:
Students_School
---------------
Applederry
Barnet Boys
...
Clearly, you need a JOIN -- two in fact. Your table has exams, students, and a junction/association table that represents the many-to-many relationship between these entities.
So, I would expect the FROM clause to look like:
FROM ExamInfo e JOIN
ExamEntry ee
ON ee.ExamEntry_ExamNo = e.ExamNo JOIN
Students s
ON ee.ExamEntry_StudentId = s.Students_Id

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?

Database design for Group Supervision

I am currently having an issue with my database that requires supervisors to monitor a group with students in the group.
Entites: Student, Supervisor and Group
A Student can only be in one group but the group can have many students
A Group can have only one Supervisor but Supervisors can have Many Groups
I hope this Image will explain more:
Here how it is supposed to be according to your data model explained.
As explained, removed StudentID from Groups and added GroupID into Students since Groups can have MANY students but Student can be assigned to only ONE group.
SupervisorID should stay in Groups since Groups can have only ONE Supervisor.

Best technique to implement skill matrix

Recently I was asked to design a portal where students can upload their technical skills like: HTML, PHP, C++ etc. and college can search the students based on the mandatory and optional skills.
Initially I thought of storing the student and their related skills details using a two columned table where first column represents the student and second column consists of all the skills related to that student separated by comma. For example,
001 HTML,C,C++,JAVA
002 C,JAVA
003 HTML,.NET
...
...
But now I'm facing problems in querying and searching for the student who have relevant skills. I tried a lot but end up with no clue on how this can be achieve.
Any pointers on storing techniques and searching algorithms etc. would be helpful. Help is much appreciated.
Thanks
A simple way to handle this is to have three tables. The first table contains students and includes a unique ID for each student. The second table contains skills and has a unique ID for each skill. The third table is for cross-referencing the first two and has two columns: "Student ID" and "Skill ID".
E.G. Let's say the skill table has an entry for "C" with ID 1, and for "C++" with an ID of 2. We have a student with an ID of 1 who knows both C and C++. We put two entries in cross-reference, the first entry has a student ID of 1 and a skill ID of 1, the second entry has a student ID of 1 and a skill ID of 2.
When you need to find out what skills a student has you just find all the rows in the cross reference table for that student ID. Conversely, if you want to find out what students have a certain skill you just find all the rows with that skill ID.

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!