I have two tables, say teacher and student. I want to build a third table called class.
There will be one column in the class table for the teacher of this class, but I want to see if this is an elegant way to represent students. My first thought is to say 30 columns .. student1, student2 and have quids for each of them that snap to a row in the student table.
But I ask you to see if there is a more preferable solution. The above solution seems awkward.
If it were me, I would have a fourth table, called participants or similar, which connects students to the class, as this is the attitude of many to many. Which will contain the class identifier and student ID at least ..
The class "table" is not a table, but the result of starting a stored procedure with data rotation.
And the data structure is as follows:
Student: Id, ... Teacher: Id, ... StudentClass: StudentId, ClassId, ... Class: Id, TeacherId, ...
SQL Server , . , PIVOT/ ,
.
:
, . .
Source: https://habr.com/ru/post/1765861/More articles:Deny website url using javascript - javascriptIs it possible to find out which lines of source code were executed? - cWhy doesn't jQuery accept this string? - jqueryHow to send database updates? - javaPartial jQuery function to load Rails? - jqueryFallback / Default AppSettings? - c #Android - ViewSwitcher does not switch views - androidHow to use Zombie when debugging an iPhone application? - iphoneASP.NET MVC custom principle - authenticationIs there a limit on how many times FBML.XFBML.parse () can be called on the page? - jqueryAll Articles