Thinking exercise

 Database relationships:

Required data content query:

Queries least studied student number "1" with other students for all courses students learn numbers and names;

Ideas: student achievement tables and table joins up, check out the number, name, provided that: the results of the table number and the course number is the same school a classmate of course (so you can find out what the students learned science Number a number of school students), and in the condition can be detected as the number of courses a student number of students is 2, the number of courses is equal to 2 students studied for the full course of a school number of students

 

The idea from the beginning was: check out a number of students to learn the course number, and then find out all the numbers of students according to curriculum (that is to detect all the students and course number x number of courses for all students y), the answer is the intersection of two of them, illustrated as follows:

 

 

 

 

 

Multi-incurable diseases such databases do help thinking logic hair open. You do not know how to do it when other people do not immediately think to ask or check the internet, we must first think of himself, as if the two ideas above, as if by second thoughts go, then the code and more, as well as the intersection do not know how to express. Often a lot of time to change the direction of their own ideas, the event becomes a lot clearer

Guess you like

Origin blog.csdn.net/weixin_44588370/article/details/90613153