Say we have three entities in our environment, Teacher, Student and Course.
Every teacher has (teaches) 1 or more Courses and each Course is offered by 0 or more teachers
Every Student has taken 1 or more Courses and each Course is taken by 0 or more Students
Every Teacher has 0 or more Students and each Student has 1 or more Teachers
In this relationships, each relationship could be inferred from the two others, for example to know which Students are being taught by Teacher T1, go through the relationship between Teacher and Course to see what Courses are being taught by the teacher T1, and then go through the relationship between Course and Student to see which Students has taken these Courses. These Students are the ones that are being taught by teacher T1.
So we don't need an explicit relationship between Student and Teacher, because "Conceptually" this relationship exists.
Finally the question is:
In Conceptual Design is it necessary to show all the three relationships?
And as an extra information, how would it be in Logical Design (designing database tables and relationships), should the relationship remain as an inferred relationship or should be explicitly defined ?
Here is an example,
Conceptual (using NORMA)
Teacher teaches Course
It is possible that some Teacher teaches more than one Course and that for some Course, more than one Teacher teaches that Course.
In each population of Teacher teaches Course, each Teacher, Course combination occurs at most once.
Student takes Course
It is possible that some Student takes more than one Course and that for some Course, more than one Student takes that Course.
In each population of Student takes Course, each Student, Course combination occurs at most once.
Teacher tutors Student on Course
For each Student and Course, at most one Teacher tutors that Student on that Course.
Constraints
For each Teacher and Course, that Teacher tutors some Student on that Course if and only if that Teacher teaches that Course.
For each Student and Course, some Teacher tutors that Student on that Course if and only if that Student takes that Course.
Logical
Related
I basically want to show in the model a relationship in a school
Teacher can teach one or many subjects
Teacher can teach one or many class
Student can attend one or many subjects
Student can have one or many teachers
Student can be registered for one or many class
Class can have one or more subjects
Is my model so far meet the relationship above?
my Diagram
I have such entities:
There are teachers, students, languages, courseGroups and a junction table GroupStudent
Every courseGroup can have only one teacher and one language, but every teacher and language can have multiple courses.
Also, there are students. Every student can have a few courses and every course can have a few students.
I'm not sure about this. Is it the right scheme?
Why do I think so?
I have a task. I have to calculate the number of students in every group, who study English.
The problem: I don't know how to find students who study English. It would be easier if student could have only one course. Then I'd have just check all English courses. However, student can have a few courses.
Example: Student Stepan has (CourseGroupid=1) an English course and (CourseGroupid=2) a Spanish course. I have to calculate this student for both groups.
P.S. I'd be very grateful if you'd just hit me is it possible to complete the task with this database or how to remake it :)
Do a DISTINCT select on Students.Id to get every student at max once. Then JOIN GroupStudent, CourseGroups and Languages. Lastly add a WHERE clause on Languages.Name = 'English'. You should be able to figure out the exact SQL on your own
I am new to using UML and I am not sure if my diagram is correct. I would like some advice from someone more experienced than me.
The statement of my problema says:
Students study courses and each student can take several courses "studies" each. Any course can have more than one student studying it.
Students, who are identified by a numerical code, have a name, date of birth and one or more nationalities.
A student who studies can receive scholarships.
A Student can recieve more than one scholarship per course. And an
individual scholarship can be given to more than one student. The
scholarships have a numeric code, which identifies them, a name, a
base amount and different conditions to be fulfilled at the time of
the assignment.
My proposal is the following:
What I want is to represent students, grants and the courses the student takes, and I am not sure if I should use an associative relation or a ternary relation.
Can anybody confirm if my proposal UML diagram is the right one?
The only statement directly relating students, courses & grants is the unclear "[a s]tudent can receive more than one grant per course".
It only actually says that each student-course pair can have more than one associated grant. (Maybe the author of the assignment thought that that "per" sentence is saying more than that, but it's not.) It doesn't say of a student whether their grants depend on their courses, and if so how. Your design is best when given a triplet you can't tell anything about any other triplet. The design with Takes(student,course) & Receives(student, course, grant) with th FK (foreign key) {student, course} from Receives to Takes is best when if you know a student & course pair then you know its grants. If grants are given to a student independently of courses then a design with Takes(student,course) & Receives(student,grant) is enough.
Clarify with your instructor.
Almost. The lozenge (or diamond) shaped element is itself an association class which associates all connected classes. What you want it a simple association class between Student and Studies like this:
The Scholarship represents the exams passed by the students in specific studies. The association class relation is indicated by the dashed line linked to the association (which has a m-n multiplicity).
Before you get to any attributes, I don't see a correlation between the nouns in the problem statement and your classes. I would expect to see the following classes:
Student
Course
Nationality
Scholarship
I would also expect to see an association class, called CourseEnrollment, that would have the following italicized properties at the ends of the association:
Student studiedCourse [1..*] Course
Course studyingStudent [1..*] Student
That association class would have yet another association with Scholarship, called ScholarshipAward, that would have the following italicized properties at the ends of the association:
CourseEnrollment awardedScholarship [0..*] Scholarship
Scholarship receivingCourseEnrollment [0..*] CourseEnrollment
With this arrangement, a Scholarship can be awarded to a combination of Student and Course.
I'm working since few weeks now on a project really interesting but unfortunately with a very complex background.
I already asked 3 questions :
Class Scheduling to Boolean satisfiability [Polynomial-time reduction] Final Part (here)
Class Scheduling to Boolean satisfiability [Polynomial-time reduction] part 2
Class Scheduling to Boolean satisfiability [Polynomial-time reduction]
in both of them, I get my answer (thank you again #Amit) but now arrived the final part, who will make this project useable :)
I for now can manage :
N time-intervals.
C courses.
T teachers.
S rooms.
My constraints are the follow:
2 teachers cannot be in the same room in the same time.
2 courses cannot be in the same room in the same time.
Teachers can teach only specific courses.
Some courses can happen only on specific time-intervals.
So this is for now, my result :
But here comes the final part that I want to add : I want to manage group of students, with the following constraints :
A group has only some courses to do.
2+ groups can be in the same room in the same time only for specific courses (like Magistral course for example)
Again, I success to isolate the constraint, but I have no idea on how to transform this constraint into a "time-intervals should not overlap" constraint.
Thanks in advance,
Best regards,
Since a student can only be in one place at a time:
Lectures for courses attached to the same student group should not overlap in time.
Edit:
There should be no constraint on different student groups overlapping. If you have such a constraint you should remove it!
The constraints are on courses. If you schdeule a lecture for course A, then it may not overlap a lecture for any other course for the student group(s) that attend course A. It may also not overlap any other course held by the same teacher.
So, you have a many-to-many relationship between students and courses and a many-to-many relationship between teachers and courses.
You want to schedule a number of lectures for each course with the constraint that no teacher and no student has overlapping lectures.
Regarding
2+ groups can be in the same room in the same time only for specific courses (like Magistral course for example)
If the groups may not mix, then it is not the same course (even though the subject may be the same). So if two student groups can not mix for Java, then you need to model it as two separate courses, Java group1 and Java group2.
I am trying to model a student database but I am unsure of how to represent the student, assessment taken, and student results. Below is the description of the scenario:
Several students are offering one or more subjects, these subjects have one or more assessments. How would the you represent students, the subject offered, the assessment taken and the results of the assessment taken by the students? I have attached a copy of the design I made so far.
my intension is to design a database where querying of the student,subject,assessment,
and assessment result can be possible and easy.
Full-size image
IMHO you should have a ternary relationship between student, subject and assessment owning the assessment result. This is necessary in the case where a student can have many subject for the same assessment.
Otherwise if an assessment have many subject but only one for a given student you have different choice :
You can keep the ternary.
You can otherwise store the subject id and result in a student - assessment relationship table
or the student id and result in a subject - assessment table.
This should depend on the way you will usually query those tables (all subject for assessment A, all students with subject X for assessment A, all results for subject X for assessment A, etc...
This have several ways to resolve, but why you don't use the Students*---*Subject relationship to associate the assessment to. Because assessment is directly related with this association. So it can't make sense without the relation between a student and a Subject.
You can call the derived table from the has_and_belongs to many relationship between Students and Subject, Assessment with the following fields(There is no place that obey you to call this association student_subjects):
ASSESSMENT
id:PK
student_id:FK
subject_id:FK
assessment_result
created_at, TIMESTAMP
Imagine that the student can make several assessments during their school year, you can save phase 1, phase 2, or Exam1, Exam2, etc... in other field in this table.
The timestamp will provide you a way to know the last result that a student had for a subject.
This is just my point of view, correct me if there is something that i'm not seeing.