my task is to combine several rows into one column, only the rule is that some of the things that are repeated should stay. Task is to the student table. I will give an example:
Student_ID | Sex | Field_Of_Study | Department | Term | Subject | Grade_1 | Grade_2 | Grade_3|
-----------|-----|----------------|------------|------|---------|---------|---------|--------|
1 M Comp_scie Inf 3 Electr 2 3 0
1 M Comp_scie Inf 3 Python 4 0 0
1 M Comp_scie Inf 3 Java 3 4 0
And my task is to make it looks like that:
Student_ID | Sex | Field_Of_Study | Department | Term | Subject_1 | Grade_11 | Grade_12 | Grade_13| Subject_2 | Grade_21 | Grade_22 | Grade_23| Subject_3 | Grade_31 | Grade_32 | Grade_33|
-----------|-----|----------------|------------|------|-----------|----------|----------|---------|-----------|----------|----------|---------|-----------|----------|----------|---------|
1 M Comp_scie Inf 3 Electr 2 3 0 Python 4 0 0 SQL 2 3 0
Is there any option to make it looks like this using SQL ?
I tried to create a script that will arrange this table, but I have too little skills to connect it in this way or at least similar.