I was asked a basic SQL question during an interview and I was stumped by it. I couldnt come up with a solution. The table structure and data are given below :
Student ID | Subject | Marks |
---|---|---|
1 | Maths | 20 |
1 | Bio | 30 |
2 | Maths | 40 |
2 | Bio | 50 |
3 | Maths | 60 |
3 | Bio | 70 |
The output should be :
Student ID | Maths | Bio |
---|---|---|
1 | 20 | 30 |
2 | 40 | 50 |
3 | 60 | 70 |
What will be the query to get the desired output?